Skip to content

Commit

Permalink
check for stopping the query in between dialing and querying
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann authored and Stebalien committed Mar 4, 2020
1 parent 29f8bb3 commit 66d3bb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 66d3bb4

Please sign in to comment.