summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJames Sanderson <jsanderson@tailscale.com>2025-04-17 19:36:55 +0100
committerJames Sanderson <jsanderson@tailscale.com>2025-04-17 19:36:55 +0100
commite475c589e6ed67ce1262732badff969f47a2a85f (patch)
treedc4151652a9a25f78cd33606e5bd58fafd458c70
parent906b1e01f265fb8a5429ff0f808f3465b0a8ee70 (diff)
downloadtailscale-zofrex/poc-health-v2.tar.xz
tailscale-zofrex/poc-health-v2.zip
wip, health status icons now workzofrex/poc-health-v2
-rw-r--r--health/health.go18
-rw-r--r--ipn/ipnlocal/local.go17
2 files changed, 15 insertions, 20 deletions
diff --git a/health/health.go b/health/health.go
index 714c5859c..d0102bace 100644
--- a/health/health.go
+++ b/health/health.go
@@ -455,6 +455,12 @@ func (t *Tracker) setHealthyLocked(w *Warnable) {
}
}
+func (t *Tracker) notifyWatchersLocked() {
+ for _, cb := range t.watchers {
+ go cb(nil, nil)
+ }
+}
+
// AppendWarnableDebugFlags appends to base any health items that are currently in failed
// state and were created with MapDebugFlag.
func (t *Tracker) AppendWarnableDebugFlags(base []string) []string {
@@ -647,6 +653,7 @@ func (t *Tracker) SetControlHealth(problems []tailcfg.Health) {
defer t.mu.Unlock()
t.controlHealth = problems
t.selfCheckLocked()
+ t.notifyWatchersLocked()
}
// GotStreamedMapResponse notes that we got a tailcfg.MapResponse
@@ -1151,17 +1158,6 @@ func (t *Tracker) updateBuiltinWarnablesLocked() {
t.setHealthyLocked(derpRegionErrorWarnable)
}
- if t.controlHealth != nil {
- // for _, cb := range t.watchers {
- // go cb(nil, nil)
- // }
- if len(t.controlHealth) > 0 {
- t.setUnhealthyLocked(controlHealthWarnable, nil)
- } else {
- t.setHealthyLocked(controlHealthWarnable)
- }
- }
-
if err := envknob.ApplyDiskConfigError(); err != nil {
t.setUnhealthyLocked(applyDiskConfigWarnable, Args{
ArgError: err.Error(),
diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go
index c967cdab1..dec132c67 100644
--- a/ipn/ipnlocal/local.go
+++ b/ipn/ipnlocal/local.go
@@ -967,15 +967,14 @@ func (b *LocalBackend) linkChange(delta *netmon.ChangeDelta) {
}
}
-func (b *LocalBackend) onHealthChange(w *health.Warnable, us *health.UnhealthyState) {
- if w == nil {
- return
- }
- if us == nil {
- b.logf("health(warnable=%s): ok", w.Code)
- } else {
- b.logf("health(warnable=%s): error: %s", w.Code, us.Text)
- }
+func (b *LocalBackend) onHealthChange(_ *health.Warnable, us *health.UnhealthyState) {
+ // if w != nil {
+ // if us == nil {
+ // b.logf("health(warnable=%s): ok", w.Code)
+ // } else {
+ // b.logf("health(warnable=%s): error: %s", w.Code, us.Text)
+ // }
+ // }
// Whenever health changes, send the current health state to the frontend.
state := b.health.CurrentState()