mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-04-24 14:22:13 +00:00
fix(query): cancel the context when the query finishes
This commit is contained in:
parent
30ba05e268
commit
e6a4d6a3dd
4
query.go
4
query.go
@ -125,6 +125,10 @@ func newQueryRunner(q *dhtQuery) *dhtQueryRunner {
|
||||
}
|
||||
|
||||
func (r *dhtQueryRunner) Run(ctx context.Context, peers []peer.ID) (*dhtQueryResult, error) {
|
||||
// Make sure to clean everything up when we return from this function.
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
r.log = logger
|
||||
r.runCtx = ctx
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user