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)