control/controlclient: replace a status func with Observer interface

For now the method has only one interface (the same as the func it's
replacing) but it will grow, eventually with the goal to remove the
controlclient.Status type for most purposes.

Updates #1909

Change-Id: I715c8bf95e3f5943055a94e76af98d988558a2f2
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-08-28 15:27:39 -07:00
committed by Brad Fitzpatrick
parent a64593d7ef
commit 55bb7314f2
5 changed files with 34 additions and 21 deletions

View File

@@ -162,7 +162,7 @@ func (cc *mockControl) send(err error, url string, loginFinished bool, nm *netma
cc.authBlocked = false
cc.mu.Unlock()
}
if cc.opts.Status != nil {
if cc.opts.Observer != nil {
pv := cc.persist.View()
s := controlclient.Status{
URL: url,
@@ -175,7 +175,7 @@ func (cc *mockControl) send(err error, url string, loginFinished bool, nm *netma
} else if url == "" && err == nil && nm == nil {
s.LogoutFinished = &empty.Message{}
}
cc.opts.Status(s)
cc.opts.Observer.SetControlClientStatus(s)
}
}