tailscale/wgengine/magicsock
Brad Fitzpatrick 37903a9056 wgengine/magicsock: fix occasional deadlock on Conn.Close on c.derpStarted
The deadlock was:

* Conn.Close was called, which acquired c.mu
* Then this goroutine scheduled:

    if firstDerp {
        startGate = c.derpStarted
        go func() {
            dc.Connect(ctx)
            close(c.derpStarted)
        }()
    }

* The getRegion hook for that derphttp.Client then ran, which also
  tries to acquire c.mu.

This change makes that hook first see if we're already in a closing
state and then it can pretend that region doesn't exist.
2020-07-27 12:27:10 -07:00
..
magicsock_test.go wgengine/magicsock: log better with less spam on transition to stopped state 2020-07-27 10:19:17 -07:00
magicsock.go wgengine/magicsock: fix occasional deadlock on Conn.Close on c.derpStarted 2020-07-27 12:27:10 -07:00