From 7c76435bf79e3c942ebca72dfbfa61f51ec447f1 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Thu, 14 Jan 2021 16:51:17 -0800 Subject: [PATCH] wgengine/magicsock: simplify Signed-off-by: Josh Bleecher Snyder --- wgengine/magicsock/magicsock.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index fc1c1a8b4..ad5d1003e 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -2253,11 +2253,10 @@ func (c *Conn) LastMark() uint32 { return 0 } // Only the first close does anything. Any later closes return nil. func (c *Conn) Close() error { c.mu.Lock() + defer c.mu.Unlock() if c.closed { - c.mu.Unlock() return nil } - defer c.mu.Unlock() for _, ep := range c.endpointOfDisco { ep.stopAndReset()