Commit 3f773ebd authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

bitswap net: always close

parent cdefdb39
......@@ -97,14 +97,12 @@ func (bsnet *impl) Provide(ctx context.Context, k util.Key) error {
// handleNewStream receives a new stream from the network.
func (bsnet *impl) handleNewStream(s inet.Stream) {
defer s.Close()
if bsnet.receiver == nil {
return
}
go func() {
defer s.Close()
received, err := bsmsg.FromNet(s)
if err != nil {
go bsnet.receiver.ReceiveError(err)
......@@ -113,7 +111,6 @@ func (bsnet *impl) handleNewStream(s inet.Stream) {
p := s.Conn().RemotePeer()
ctx := context.Background()
log.Debugf("bsnet handleNewStream from %s", s.Conn().RemotePeer())
bsnet.receiver.ReceiveMessage(ctx, p, received)
}()
}
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