diff options
author | Attila Gazso <attila.gazso@prezi.com> | 2018-10-18 01:22:37 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-10-18 01:22:37 +0800 |
commit | cdf5982cfca2cd7d5fea85c226af5e48fde837df (patch) | |
tree | adcd4a5b24d285ca72174c085bd17a898b628721 /swarm/network/stream/messages.go | |
parent | 4e693ad5a6f118dcf4f3586938c17fc8ef5822b5 (diff) | |
download | dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.gz dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.bz2 dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.lz dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.xz dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.zst dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.zip |
swarm: Lightnode mode: disable sync, retrieve, subscription (#17899)
* swarm: Lightnode mode: disable sync, retrieve, subscription
* swarm/network/stream: assign error and check in one line
* swarm: restructured RegistryOption initializing
* swarm: empty commit to retrigger CI build
* swarm/network/stream: Added comments explaining RegistryOptions
Diffstat (limited to 'swarm/network/stream/messages.go')
-rw-r--r-- | swarm/network/stream/messages.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/swarm/network/stream/messages.go b/swarm/network/stream/messages.go index 74c785d58..68503fe1f 100644 --- a/swarm/network/stream/messages.go +++ b/swarm/network/stream/messages.go @@ -76,7 +76,16 @@ type RequestSubscriptionMsg struct { func (p *Peer) handleRequestSubscription(ctx context.Context, req *RequestSubscriptionMsg) (err error) { log.Debug(fmt.Sprintf("handleRequestSubscription: streamer %s to subscribe to %s with stream %s", p.streamer.addr, p.ID(), req.Stream)) - return p.streamer.Subscribe(p.ID(), req.Stream, req.History, req.Priority) + if err = p.streamer.Subscribe(p.ID(), req.Stream, req.History, req.Priority); err != nil { + // The error will be sent as a subscribe error message + // and will not be returned as it will prevent any new message + // exchange between peers over p2p. Instead, error will be returned + // only if there is one from sending subscribe error message. + err = p.Send(ctx, SubscribeErrorMsg{ + Error: err.Error(), + }) + } + return err } func (p *Peer) handleSubscribeMsg(ctx context.Context, req *SubscribeMsg) (err error) { |