Fix some Hostinfo value usages from the previous commit.

pull/103/head
Brad Fitzpatrick 5 years ago
parent d8de11a01b
commit 758744a4e3

@ -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)
}, },

@ -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,
} }
} }

@ -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

Loading…
Cancel
Save