Skip to content

Commit 3e30658

Browse files
committed
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 libp2p/go-libp2p-net#28 License: MIT Signed-off-by: Steven Allen <[email protected]>
1 parent 454a170 commit 3e30658

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

exchange/bitswap/network/ipfs_impl.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ func (bsnet *impl) SendMessage(
123123
s.Reset()
124124
return err
125125
}
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+
129130
}
130131

131132
func (bsnet *impl) SetDelegate(r Receiver) {

0 commit comments

Comments
 (0)