From 6a0f6efc18fd8b703ec0d245d97e4418d2fba42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Mon, 20 Jan 2025 16:28:16 +0100 Subject: [PATCH] Always stop timer --- client/internal/peer/endpoint.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/internal/peer/endpoint.go b/client/internal/peer/endpoint.go index c2392bf59..98c71af90 100644 --- a/client/internal/peer/endpoint.go +++ b/client/internal/peer/endpoint.go @@ -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()