From 227f73284fdc4cbfd3ef94e1d35d91d99cfef43e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 9 Apr 2021 12:10:52 -0700 Subject: [PATCH] ipn/ipnlocal: eagerly announce peerapi service(s) on change We were previously only doing it as a side effect of the port poller, which doesn't run on e.g. iOS. Updates tailscale/corp#1559 --- ipn/ipnlocal/local.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index fc3396132..534cefac5 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1423,6 +1423,10 @@ func (b *LocalBackend) peerAPIServicesLocked() (ret []tailcfg.Service) { // TODO(danderson): we shouldn't be mangling hostinfo here after // painstakingly constructing it in twelvety other places. func (b *LocalBackend) doSetHostinfoFilterServices(hi *tailcfg.Hostinfo) { + if hi == nil { + b.logf("[unexpected] doSetHostinfoFilterServices with nil hostinfo") + return + } b.mu.Lock() cc := b.cc if cc == nil { @@ -1682,6 +1686,8 @@ func (b *LocalBackend) initPeerAPIListener() { go pln.serve() b.peerAPIListeners = append(b.peerAPIListeners, pln) } + + b.doSetHostinfoFilterServices(b.hostinfo) } // magicDNSRootDomains returns the subset of nm.DNS.Domains that are the search domains for MagicDNS.