Commit 4e793b15 authored by Brian Tiger Chow's avatar Brian Tiger Chow

fix: respect ctx on receive

@jbenet

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 88f4481c
......@@ -107,10 +107,15 @@ func (pm *ProviderManager) GetProviders(ctx context.Context, k u.Key) []peer.Pee
resp: make(chan []peer.Peer, 1), // buffered to prevent sender from blocking
}
select {
case <-ctx.Done():
return nil
case pm.getprovs <- gp:
return <-gp.resp
}
select {
case <-ctx.Done():
return nil
case peers := <-gp.resp:
return peers
}
}
......
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