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
This commit is contained in:
Brad Fitzpatrick 2021-04-09 12:10:52 -07:00
parent fe23506471
commit 227f73284f

View File

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