提交 d8a5bd05 作者: Juan Batiz-Benet

dht/query: make sure to cancel all contexts.

We are leaking peer queues:

http://gateway.ipfs.io/ipfs/QmQxVA48CzVwwNYExUiFe56VrUBn8u368ZfchnCLoc7fSC/moriarty
上级 e384aec2
......@@ -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)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论