summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJames Sanderson <jsanderson@tailscale.com>2025-10-22 15:14:18 +0100
committerJames Sanderson <jsanderson@tailscale.com>2025-10-22 15:16:01 +0100
commita0d0812969838e6b5b36fb360bdf34d041cc20c5 (patch)
tree6d4931e4c826aaafe1459bcaca762453825684f5
parentafaa23c3b4c5fcbb7a62d42831a5b7e55e30eeac (diff)
downloadtailscale-zofrex/auto-login-comments.tar.xz
tailscale-zofrex/auto-login-comments.zip
control/controlclient: update docs for map & auth contextzofrex/auto-login-comments
Updates #cleanup Signed-off-by: James Sanderson <jsanderson@tailscale.com>
-rw-r--r--control/controlclient/auto.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/control/controlclient/auto.go b/control/controlclient/auto.go
index 9f5bf38ae..545fe8412 100644
--- a/control/controlclient/auto.go
+++ b/control/controlclient/auto.go
@@ -253,7 +253,8 @@ func (c *Auto) updateControl() {
}
}
-// cancelAuthCtxLocked is like cancelAuthCtx, but assumes the caller holds c.mu.
+// cancelAuthCtxLocked cancels the [Auto.authRoutine] goroutine's context &
+// creates a new one, causing it to restart. Assumes the caller holds c.mu.
func (c *Auto) cancelAuthCtxLocked() {
if c.authCancel != nil {
c.authCancel()
@@ -264,7 +265,9 @@ func (c *Auto) cancelAuthCtxLocked() {
}
}
-// cancelMapCtxLocked is like cancelMapCtx, but assumes the caller holds c.mu.
+// cancelMapCtxLocked cancels the context for the [Auto.mapRoutine] and
+// [Auto.updateRoutine] goroutines and creates a new one, causing them to
+// restart. Assumes the caller holds c.mu.
func (c *Auto) cancelMapCtxLocked() {
if c.mapCancel != nil {
c.mapCancel()
@@ -275,8 +278,9 @@ func (c *Auto) cancelMapCtxLocked() {
}
}
-// restartMap cancels the existing mapPoll and liteUpdates, and then starts a
-// new one.
+// restartMap cancels the the context for the [Auto.mapRoutine] and
+// [Auto.updateRoutine] goroutines, and then creates a new one, causing them to
+// restart.
func (c *Auto) restartMap() {
c.mu.Lock()
c.cancelMapCtxLocked()
@@ -702,8 +706,8 @@ func (c *Auto) Login(flags LoginFlags) {
c.loginGoal = &LoginGoal{
flags: flags,
}
- c.cancelMapCtxLocked()
- c.cancelAuthCtxLocked()
+ c.cancelMapCtxLocked() // unblocks [Auto.mapRoutine] & [Auto.updateRoutine]
+ c.cancelAuthCtxLocked() // unblocks [Auto.authRoutine]
}
var ErrClientClosed = errors.New("client closed")