Commit d01e7e19 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

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.
parent fa45a7db
...@@ -107,6 +107,7 @@ func (bsnet *impl) FindProvidersAsync(ctx context.Context, k util.Key, max int) ...@@ -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:
} }
} }
......
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