diff --git a/health/health.go b/health/health.go index 5c004b589..48beec3df 100644 --- a/health/health.go +++ b/health/health.go @@ -168,7 +168,8 @@ func GotStreamedMapResponse() { selfCheckLocked() } -// SetInPollNetMap records that we're in +// SetInPollNetMap records whether the client has an open +// HTTP long poll open to the control plane. func SetInPollNetMap(v bool) { mu.Lock() defer mu.Unlock() @@ -183,6 +184,14 @@ func SetInPollNetMap(v bool) { } } +// GetInPollNetMap reports whether the client has an open +// HTTP long poll open to the control plane. +func GetInPollNetMap() bool { + mu.Lock() + defer mu.Unlock() + return inMapPoll +} + // SetMagicSockDERPHome notes what magicsock's view of its home DERP is. func SetMagicSockDERPHome(region int) { mu.Lock() diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index d1805ef34..8cc0e3809 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -380,6 +380,7 @@ func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func } }) sb.MutateSelfStatus(func(ss *ipnstate.PeerStatus) { + ss.Online = health.GetInPollNetMap() if b.netMap != nil { ss.HostName = b.netMap.Hostinfo.Hostname ss.DNSName = b.netMap.Name