From 66d3bb4bf3c045bda6eb67a614a25e2546c04525 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Tue, 4 Feb 2020 11:56:50 -0500 Subject: [PATCH] check for stopping the query in between dialing and querying --- query.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/query.go b/query.go index 76361a19d..a9ae26e34 100644 --- a/query.go +++ b/query.go @@ -280,6 +280,11 @@ func (q *qu) queryPeer(ctx context.Context, p peer.ID) *queryResult { return &queryResult{} } + if q.stopFn(q.localPeers) { + q.cancel() + return &queryResult{} + } + newPeers, err := q.queryFn(queryCtx, p) if err != nil { q.localPeers.Remove(p)