swarm/network/stream: disambiguate chunk delivery messages (retrieval… (#17920)
* swarm/network/stream: disambiguate chunk delivery messages (retrieval vs syncing) * swarm/network/stream: addressed PR comments * swarm/network/stream: stream protocol version change due to new message types in this PR
This commit is contained in:
@@ -489,8 +489,13 @@ func (p *Peer) HandleMsg(ctx context.Context, msg interface{}) error {
|
||||
case *WantedHashesMsg:
|
||||
return p.handleWantedHashesMsg(ctx, msg)
|
||||
|
||||
case *ChunkDeliveryMsg:
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, msg)
|
||||
case *ChunkDeliveryMsgRetrieval:
|
||||
//handling chunk delivery is the same for retrieval and syncing, so let's cast the msg
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, ((*ChunkDeliveryMsg)(msg)))
|
||||
|
||||
case *ChunkDeliveryMsgSyncing:
|
||||
//handling chunk delivery is the same for retrieval and syncing, so let's cast the msg
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, ((*ChunkDeliveryMsg)(msg)))
|
||||
|
||||
case *RetrieveRequestMsg:
|
||||
return p.streamer.delivery.handleRetrieveRequestMsg(ctx, p, msg)
|
||||
@@ -681,7 +686,7 @@ func (c *clientParams) clientCreated() {
|
||||
// Spec is the spec of the streamer protocol
|
||||
var Spec = &protocols.Spec{
|
||||
Name: "stream",
|
||||
Version: 7,
|
||||
Version: 8,
|
||||
MaxMsgSize: 10 * 1024 * 1024,
|
||||
Messages: []interface{}{
|
||||
UnsubscribeMsg{},
|
||||
@@ -690,10 +695,11 @@ var Spec = &protocols.Spec{
|
||||
TakeoverProofMsg{},
|
||||
SubscribeMsg{},
|
||||
RetrieveRequestMsg{},
|
||||
ChunkDeliveryMsg{},
|
||||
ChunkDeliveryMsgRetrieval{},
|
||||
SubscribeErrorMsg{},
|
||||
RequestSubscriptionMsg{},
|
||||
QuitMsg{},
|
||||
ChunkDeliveryMsgSyncing{},
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user