control/ts2021: fix data race during concurrent Close and conn ending
Fixes tailscale/corp#33125 Change-Id: I9911f5059d5ebe42ecf7db9becb2326cca240765 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
109cb50d5f
commit
9556a0c6da
@@ -180,6 +180,7 @@ func (nc *Client) Close() error {
|
|||||||
nc.mu.Lock()
|
nc.mu.Lock()
|
||||||
live := nc.connPool
|
live := nc.connPool
|
||||||
nc.closed = true
|
nc.closed = true
|
||||||
|
nc.connPool = nil // stop noteConnClosed from mutating it as we loop over it (in live) below
|
||||||
nc.mu.Unlock()
|
nc.mu.Unlock()
|
||||||
|
|
||||||
for _, c := range live {
|
for _, c := range live {
|
||||||
|
|||||||
Reference in New Issue
Block a user