From a0d0812969838e6b5b36fb360bdf34d041cc20c5 Mon Sep 17 00:00:00 2001 From: James Sanderson Date: Wed, 22 Oct 2025 15:14:18 +0100 Subject: [PATCH] control/controlclient: update docs for map & auth context Updates #cleanup Signed-off-by: James Sanderson --- control/controlclient/auto.go | 16 ++++++++++------ 1 file 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")