fix(bitswap/network): return when context is done
@jbenet @whyrusleeping This bug (missing return) could tie up the client worker and cause operations to come to a halt.
Brian Tiger Chow committed
Jan 3, 2015 at 17:15 UTC
05d8c80c394353a29f4caadcfa11b01fd43d3c9d
1 file changed
+1
exchange/bitswap/network/ipfs_impl.go
+1
@@ -107,6 +107,7 @@ func (bsnet *impl) FindProvidersAsync(ctx context.Context, k util.Key, max int)
107
bsnet.host.Peerstore().AddAddresses(info.ID, info.Addrs)
108
select {
109
case <-ctx.Done():
110
+ return
111
case out <- info.ID:
112
}
113
}