summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJames Tucker <james@tailscale.com>2023-06-14 10:32:36 -0700
committerJames Tucker <james@tailscale.com>2023-06-16 14:54:53 -0700
commit0fd6bf0a1c2f6d12d3debdad5e90ef7dd6403054 (patch)
treedd6c55f5f79c5d2b4fa7a50f572293f34b14b9e7
parentc783f28228edcf15c22dc6a933bf96c2e7ae8895 (diff)
downloadtailscale-raggi/heartbeat-timebomb.tar.xz
tailscale-raggi/heartbeat-timebomb.zip
wgengine/magicsock: ensure that an existing timer is stoppedraggi/heartbeat-timebomb
There presently is not a bug here, but this is a time-bomb waiting for an innocent incremental change to accidentally adjust the parent call chain resulting in a timer leak. Updates #cleanup Signed-off-by: James Tucker <james@tailscale.com>
-rw-r--r--wgengine/magicsock/magicsock.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go
index dea8b2d97..bdb328eea 100644
--- a/wgengine/magicsock/magicsock.go
+++ b/wgengine/magicsock/magicsock.go
@@ -4441,7 +4441,10 @@ func (de *endpoint) heartbeat() {
de.mu.Lock()
defer de.mu.Unlock()
- de.heartBeatTimer = nil
+ if de.heartBeatTimer != nil {
+ de.heartBeatTimer.Stop()
+ de.heartBeatTimer = nil
+ }
if de.heartbeatDisabled {
// If control override to disable heartBeatTimer set, return early.