mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
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.
This commit is contained in:

committed by
Juan Batiz-Benet

parent
64cb32dadd
commit
05d8c80c39
@ -107,6 +107,7 @@ func (bsnet *impl) FindProvidersAsync(ctx context.Context, k util.Key, max int)
|
|||||||
bsnet.host.Peerstore().AddAddresses(info.ID, info.Addrs)
|
bsnet.host.Peerstore().AddAddresses(info.ID, info.Addrs)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
case out <- info.ID:
|
case out <- info.ID:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user