1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 17:22:21 +08:00

dht/query: make sure to cancel all contexts.

We are leaking peer queues:

http://gateway.ipfs.io/ipfs/QmQxVA48CzVwwNYExUiFe56VrUBn8u368ZfchnCLoc7fSC/moriarty
This commit is contained in:
Juan Batiz-Benet
2015-02-03 12:18:30 -08:00
parent e384aec2a9
commit d8a5bd0549

View File

@ -52,6 +52,9 @@ type queryFunc func(context.Context, peer.ID) (*dhtQueryResult, error)
// Run runs the query at hand. pass in a list of peers to use first.
func (q *dhtQuery) Run(ctx context.Context, peers []peer.ID) (*dhtQueryResult, error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
runner := newQueryRunner(ctx, q)
return runner.Run(peers)
}