diff options
author | holisticode <holistic.computing@gmail.com> | 2018-10-21 15:30:41 +0800 |
---|---|---|
committer | Viktor Trón <viktor.tron@gmail.com> | 2018-10-21 15:30:41 +0800 |
commit | 88b41a9e680a764aa079051aa7c71b3c6879d60a (patch) | |
tree | ede6da904a9791d2ecc7e3fa5ec9dfb3d91e5007 /swarm/network/stream/stream.go | |
parent | 66debd91d9268067000c061093a674ce34f18d48 (diff) | |
download | go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.tar go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.tar.gz go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.tar.bz2 go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.tar.lz go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.tar.xz go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.tar.zst go-tangerine-88b41a9e680a764aa079051aa7c71b3c6879d60a.zip |
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
Diffstat (limited to 'swarm/network/stream/stream.go')
-rw-r--r-- | swarm/network/stream/stream.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/swarm/network/stream/stream.go b/swarm/network/stream/stream.go index 9d0e6c68b..0ac374def 100644 --- a/swarm/network/stream/stream.go +++ b/swarm/network/stream/stream.go @@ -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{}, }, } |