From 5fe5402fcd06a2f1b8232c7ff47d213ea3fb0e7f Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 19 Jan 2021 11:44:32 -0800 Subject: [PATCH] Revert "wgengine/magicsock: shortcircuit discoEndpoint.heartbeat when its connection is closed" This reverts commit 08baa17d9a785635891c3462d01e601759b8b8b6. It caused deadlocks due to lock ordering violations. It was not the right fix, and thus should simply be reverted while we look for the right fix (if we haven't already found it in the interim; we've fixed other logging-after-test issues). Fixes #1161 --- wgengine/magicsock/magicsock.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 67314c700..f111e5581 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -2259,13 +2259,6 @@ func (c *Conn) Close() error { return err } -// isClosed reports whether c is closed. -func (c *Conn) isClosed() bool { - c.mu.Lock() - defer c.mu.Unlock() - return c.closed -} - func (c *Conn) goroutinesRunningLocked() bool { if c.endpointsUpdateActive { return true @@ -2997,10 +2990,6 @@ func (de *discoEndpoint) heartbeat() { de.heartBeatTimer = nil - if de.c.isClosed() { - return - } - if de.lastSend.IsZero() { // Shouldn't happen. return