control/controlclient: update docs for map & auth context

Updates #cleanup

Signed-off-by: James Sanderson <jsanderson@tailscale.com>
This commit is contained in:
James Sanderson
2025-10-22 15:14:18 +01:00
parent afaa23c3b4
commit a0d0812969

View File

@@ -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")