Commit ba86f518 authored by Steven Allen's avatar Steven Allen

fix: return a closed channel from FindProvidersAsync when providers are disabled.

parent c2b72b25
......@@ -509,12 +509,13 @@ func (dht *IpfsDHT) FindProviders(ctx context.Context, c cid.Cid) ([]peer.AddrIn
// Peers will be returned on the channel as soon as they are found, even before
// the search query completes.
func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key cid.Cid, count int) <-chan peer.AddrInfo {
peerOut := make(chan peer.AddrInfo, count)
if !dht.enableProviders {
return nil
close(peerOut)
return peerOut
}
logger.Event(ctx, "findProviders", key)
peerOut := make(chan peer.AddrInfo, count)
go dht.findProvidersAsyncRoutine(ctx, key, count, peerOut)
return peerOut
......
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