mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-09 23:42:20 +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:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user