Skip to content

Commit

Permalink
autorelay: remove unused semaphore (#2184)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt authored Mar 20, 2023
1 parent 0d7e852 commit 9e20824
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions p2p/host/autorelay/relay_finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,19 +465,12 @@ func (rf *relayFinder) tryNode(ctx context.Context, pi peer.AddrInfo) (supportsR
// This function makes sure that we only run one instance of maybeConnectToRelay at once, and buffers
// exactly one more trigger event to run maybeConnectToRelay.
func (rf *relayFinder) handleNewCandidates(ctx context.Context) {
sem := make(chan struct{}, 1)
for {
select {
case <-ctx.Done():
return
case <-rf.maybeConnectToRelayTrigger:
select {
case <-ctx.Done():
return
case sem <- struct{}{}:
}
rf.maybeConnectToRelay(ctx)
<-sem
}
}
}
Expand Down

0 comments on commit 9e20824

Please sign in to comment.