wgengine/magicsock: fix race in test shutdown, again.

We were returning an error almost, but not quite like errConnClosed in
a single codepath, which could still trip the panic on reconfig in the
test logic.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2021-08-30 21:26:38 -07:00
parent f09ede9243
commit 44d71d1e42

View File

@ -2819,7 +2819,7 @@ func (c *Conn) ParseEndpoint(endpointStr string) (conn.Endpoint, error) {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
if c.closed { if c.closed {
return nil, errors.New("magicsock: Conn closed") return nil, errConnClosed
} }
node, ok := c.peerMap.nodeForNodeKey(tailcfg.NodeKey(pk)) node, ok := c.peerMap.nodeForNodeKey(tailcfg.NodeKey(pk))
if !ok { if !ok {