Commit ec092bbd authored by Jeromy Johnson's avatar Jeromy Johnson

Merge pull request #2646 from ipfs/feat/bitswap-reuse-stream

allow bitswap to read multiple messages per stream
parents aa8e4cd7 58d17505
...@@ -150,6 +150,7 @@ func (bsnet *impl) handleNewStream(s inet.Stream) { ...@@ -150,6 +150,7 @@ func (bsnet *impl) handleNewStream(s inet.Stream) {
return return
} }
for {
received, err := bsmsg.FromNet(s) received, err := bsmsg.FromNet(s)
if err != nil { if err != nil {
go bsnet.receiver.ReceiveError(err) go bsnet.receiver.ReceiveError(err)
...@@ -161,6 +162,7 @@ func (bsnet *impl) handleNewStream(s inet.Stream) { ...@@ -161,6 +162,7 @@ func (bsnet *impl) handleNewStream(s inet.Stream) {
ctx := context.Background() ctx := context.Background()
log.Debugf("bitswap net handleNewStream from %s", s.Conn().RemotePeer()) log.Debugf("bitswap net handleNewStream from %s", s.Conn().RemotePeer())
bsnet.receiver.ReceiveMessage(ctx, p, received) bsnet.receiver.ReceiveMessage(ctx, p, received)
}
} }
type netNotifiee impl type netNotifiee impl
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment