wgengine/magicsock: ensure that an existing timer is stopped

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 <[email protected]>
This commit is contained in:
James Tucker committed 2023-06-16 14:54:53 -07:00
1 parent c783f28228
commit 0fd6bf0a1c
1 file changed
+4 -1
+4 -1
View File
@@ -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.