@cryptotaxi247 / kubo / commits / 3e3065861

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: Steven Allen <steven@stebalien.com>

Steven Allen committed Jul 18, 2018 at 09:56 UTC 3e3065861db78dd633857cafe10c05287b6d3302
1 file changed +4 -3
exchange/bitswap/network/ipfs_impl.go
+4 -3
@@ -123,9 +123,10 @@ func (bsnet *impl) SendMessage(
123 s.Reset()
124 return err
125 }
126 - // Yes, return this error. We have no reason to believe that the block
127 - // was actually *sent* unless we see the EOF.
128 - return inet.FullClose(s)
126 + // TODO(https://github.com/libp2p/go-libp2p-net/issues/28): Avoid this goroutine.
127 + go inet.AwaitEOF(s)
128 + return s.Close()
129 +
130 }
131
132 func (bsnet *impl) SetDelegate(r Receiver) {