Skip to content

Commit

Permalink
Always stop timer
Browse files Browse the repository at this point in the history
  • Loading branch information
pappz committed Jan 20, 2025
1 parent a8c4556 commit 45961d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/internal/peer/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ func (e *endpointUpdater) removeWgPeer() error {
// scheduleDelayedUpdate waits for the fallback period before updating the endpoint
func (e *endpointUpdater) scheduleDelayedUpdate(ctx context.Context, addr *net.UDPAddr) {
t := time.NewTimer(fallbackDelay)
defer t.Stop()

select {
case <-ctx.Done():
t.Stop()
return
case <-t.C:
e.configUpdateMutex.Lock()
Expand Down

0 comments on commit 45961d9

Please sign in to comment.