Fix some Hostinfo value usages from the previous commit.

This commit is contained in:
Brad Fitzpatrick 2020-02-25 11:01:20 -08:00
parent d8de11a01b
commit 758744a4e3
3 changed files with 9 additions and 4 deletions

View File

@ -945,7 +945,7 @@ func (s *server) newClient(t *testing.T, name string) *client {
t.Helper() t.Helper()
t.Logf(name+": "+fmt, args...) t.Logf(name+": "+fmt, args...)
}, },
Hostinfo: &hi, Hostinfo: hi,
NewDecompressor: func() (Decompressor, error) { NewDecompressor: func() (Decompressor, error) {
return zstd.NewReader(nil) return zstd.NewReader(nil)
}, },

View File

@ -52,7 +52,7 @@ func TestClientsReusingKeys(t *testing.T) {
t.Helper() t.Helper()
t.Logf("c1: "+fmt, args...) t.Logf("c1: "+fmt, args...)
}, },
Hostinfo: &hi, Hostinfo: hi,
}) })
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -93,7 +93,7 @@ func TestClientsReusingKeys(t *testing.T) {
t.Logf("c2: "+fmt, args...) t.Logf("c2: "+fmt, args...)
}, },
Persist: c1.GetPersist(), Persist: c1.GetPersist(),
Hostinfo: &hi, Hostinfo: hi,
NewDecompressor: func() (Decompressor, error) { NewDecompressor: func() (Decompressor, error) {
return zstd.NewReader(nil) return zstd.NewReader(nil)
}, },
@ -155,7 +155,7 @@ func TestClientsReusingOldKey(t *testing.T) {
t.Helper() t.Helper()
t.Logf("c1: "+fmt, args...) t.Logf("c1: "+fmt, args...)
}, },
Hostinfo: &hi, Hostinfo: hi,
} }
} }

View File

@ -325,6 +325,11 @@ func (b *LocalBackend) runPoller() {
} }
b.mu.Lock() 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 := b.hiCache
hi.Services = sl hi.Services = sl
b.hiCache = hi b.hiCache = hi