mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-13 06:07:34 +00:00
ipn/ipnlocal: fix StatusWithoutPeers not populating parts of Status
Fixes #4311 Change-Id: Iaae0615148fa7154f4ef8f66b455e3a6c2fa9df3 Co-authored-by: Claire Wang <claire@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
3c452b9880
commit
0f604923d3
@@ -545,7 +545,7 @@ func (b *LocalBackend) sanitizedPrefsLocked() ipn.PrefsView {
|
||||
// Status returns the latest status of the backend and its
|
||||
// sub-components.
|
||||
func (b *LocalBackend) Status() *ipnstate.Status {
|
||||
sb := new(ipnstate.StatusBuilder)
|
||||
sb := &ipnstate.StatusBuilder{WantPeers: true}
|
||||
b.UpdateStatus(sb)
|
||||
return sb.Status()
|
||||
}
|
||||
@@ -553,15 +553,19 @@ func (b *LocalBackend) Status() *ipnstate.Status {
|
||||
// StatusWithoutPeers is like Status but omits any details
|
||||
// of peers.
|
||||
func (b *LocalBackend) StatusWithoutPeers() *ipnstate.Status {
|
||||
sb := new(ipnstate.StatusBuilder)
|
||||
b.updateStatus(sb, nil)
|
||||
sb := &ipnstate.StatusBuilder{WantPeers: false}
|
||||
b.UpdateStatus(sb)
|
||||
return sb.Status()
|
||||
}
|
||||
|
||||
// UpdateStatus implements ipnstate.StatusUpdater.
|
||||
func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
||||
b.e.UpdateStatus(sb)
|
||||
b.updateStatus(sb, b.populatePeerStatusLocked)
|
||||
var extraLocked func(*ipnstate.StatusBuilder)
|
||||
if sb.WantPeers {
|
||||
extraLocked = b.populatePeerStatusLocked
|
||||
}
|
||||
b.updateStatus(sb, extraLocked)
|
||||
}
|
||||
|
||||
// updateStatus populates sb with status.
|
||||
|
Reference in New Issue
Block a user