ipn: fix race in enterState

Signed-Off-By: Dmytro Shynkevych <dmytro@tailscale.com>
This commit is contained in:
Dmytro Shynkevych 2020-06-19 13:43:55 -04:00 committed by Brad Fitzpatrick
parent 53fb25fc2f
commit 00ca17edf4

View File

@ -920,6 +920,7 @@ func wgCIDRToNetaddr(cidrs []wgcfg.CIDR) (ret []netaddr.IPPrefix) {
func (b *LocalBackend) enterState(newState State) {
b.mu.Lock()
state := b.state
b.state = newState
prefs := b.prefs
notify := b.notify
b.mu.Unlock()
@ -933,7 +934,6 @@ func (b *LocalBackend) enterState(newState State) {
b.send(Notify{State: &newState})
}
b.state = newState
switch newState {
case NeedsLogin:
b.blockEngineUpdates(true)