From a8b95571fbcdbe93d3bba24264f007ec8a0780cc Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 8 Jul 2020 16:49:02 -0700 Subject: [PATCH] ipn, control/controlclient: fix some data races More remain. Fixes tailscale/corp#432 --- control/controlclient/direct.go | 2 +- ipn/local.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index 568e60311..ce9203cef 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -456,7 +456,7 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM persist := c.persist serverURL := c.serverURL serverKey := c.serverKey - hostinfo := c.hostinfo + hostinfo := c.hostinfo.Clone() backendLogID := hostinfo.BackendLogID localPort := c.localPort ep := append([]string(nil), c.endpoints...) diff --git a/ipn/local.go b/ipn/local.go index 9e3daa6bd..da5cfbbaa 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -712,11 +712,12 @@ func (b *LocalBackend) SetPrefs(new *Prefs) { newHi.Hostname = h } b.hostinfo = newHi + hostInfoChanged := !oldHi.Equal(newHi) b.mu.Unlock() b.logf("SetPrefs: %v", new.Pretty()) - if old.ShieldsUp != new.ShieldsUp || !oldHi.Equal(newHi) { + if old.ShieldsUp != new.ShieldsUp || hostInfoChanged { b.doSetHostinfoFilterServices(newHi) }