diff options
author | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-10-12 22:26:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-12 22:26:16 +0800 |
commit | 6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c (patch) | |
tree | 52f31f4bc541ed6bf9643bef11ceefd75e831d0e /swarm/network/stream/peer.go | |
parent | dc3c3fb1e177c5d01ae3ca63717130eea924271e (diff) | |
download | dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.tar dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.tar.gz dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.tar.bz2 dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.tar.lz dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.tar.xz dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.tar.zst dexon-6566a0a3b82f5d24d478d3876d5fa2b1b0e8684c.zip |
swarm/network/stream: generalise setting of next batch (#17818)
* swarm/network/stream: generalize SetNextBatch and add Server SessionIndex
* swarm/network/stream: fix a typo in comment
* swarm/network/stream: remove live argument from NewSwarmSyncerServer
Diffstat (limited to 'swarm/network/stream/peer.go')
-rw-r--r-- | swarm/network/stream/peer.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/swarm/network/stream/peer.go b/swarm/network/stream/peer.go index ef6bbdf70..89d135ad5 100644 --- a/swarm/network/stream/peer.go +++ b/swarm/network/stream/peer.go @@ -166,7 +166,7 @@ func (p *Peer) SendOfferedHashes(s *server, f, t uint64) error { "send.offered.hashes") defer sp.Finish() - hashes, from, to, proof, err := s.SetNextBatch(f, t) + hashes, from, to, proof, err := s.setNextBatch(f, t) if err != nil { return err } @@ -214,10 +214,15 @@ func (p *Peer) setServer(s Stream, o Server, priority uint8) (*server, error) { return nil, ErrMaxPeerServers } + sessionIndex, err := o.SessionIndex() + if err != nil { + return nil, err + } os := &server{ - Server: o, - stream: s, - priority: priority, + Server: o, + stream: s, + priority: priority, + sessionIndex: sessionIndex, } p.servers[s] = os return os, nil |