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
This commit is contained in:
Attila Gazso
2018-10-17 19:22:37 +02:00
committed by Viktor Trón
parent 4e693ad5a6
commit cdf5982cfc
7 changed files with 260 additions and 15 deletions

View File

@@ -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) {