Commit 8ed926d2 authored by Steven Allen's avatar Steven Allen

when sending blocks in bitswap, close streams asynchronously

Otherwise, we tie up the bitswap worker until the other side responds with an EOF.

fixes #5247
related to https://github.com/libp2p/go-libp2p-net/issues/28

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent e6367b9d
......@@ -123,9 +123,10 @@ func (bsnet *impl) SendMessage(
s.Reset()
return err
}
// Yes, return this error. We have no reason to believe that the block
// was actually *sent* unless we see the EOF.
return inet.FullClose(s)
// TODO(https://github.com/libp2p/go-libp2p-net/issues/28): Avoid this goroutine.
go inet.AwaitEOF(s)
return s.Close()
}
func (bsnet *impl) SetDelegate(r Receiver) {
......
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