From 758744a4e3daddad3f544f48d2cecd7f3289995c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 25 Feb 2020 11:01:20 -0800 Subject: [PATCH] Fix some Hostinfo value usages from the previous commit. --- control/controlclient/auto_test.go | 2 +- control/controlclient/direct_test.go | 6 +++--- ipn/local.go | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/control/controlclient/auto_test.go b/control/controlclient/auto_test.go index a4a3f10d9..51f5149a3 100644 --- a/control/controlclient/auto_test.go +++ b/control/controlclient/auto_test.go @@ -945,7 +945,7 @@ func (s *server) newClient(t *testing.T, name string) *client { t.Helper() t.Logf(name+": "+fmt, args...) }, - Hostinfo: &hi, + Hostinfo: hi, NewDecompressor: func() (Decompressor, error) { return zstd.NewReader(nil) }, diff --git a/control/controlclient/direct_test.go b/control/controlclient/direct_test.go index 803d0cdbc..4946be441 100644 --- a/control/controlclient/direct_test.go +++ b/control/controlclient/direct_test.go @@ -52,7 +52,7 @@ func TestClientsReusingKeys(t *testing.T) { t.Helper() t.Logf("c1: "+fmt, args...) }, - Hostinfo: &hi, + Hostinfo: hi, }) if err != nil { t.Fatal(err) @@ -93,7 +93,7 @@ func TestClientsReusingKeys(t *testing.T) { t.Logf("c2: "+fmt, args...) }, Persist: c1.GetPersist(), - Hostinfo: &hi, + Hostinfo: hi, NewDecompressor: func() (Decompressor, error) { return zstd.NewReader(nil) }, @@ -155,7 +155,7 @@ func TestClientsReusingOldKey(t *testing.T) { t.Helper() t.Logf("c1: "+fmt, args...) }, - Hostinfo: &hi, + Hostinfo: hi, } } diff --git a/ipn/local.go b/ipn/local.go index cf83d5ca1..e8f85e4b4 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -325,6 +325,11 @@ func (b *LocalBackend) runPoller() { } b.mu.Lock() + if b.hiCache == nil { + // TODO(bradfitz): it's a little weird that this port poller + // is started (by NewLocalBackend) before the Start call. + b.hiCache = new(tailcfg.Hostinfo) + } hi := b.hiCache hi.Services = sl b.hiCache = hi