mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 18:51:18 -08:00
controlclient: make logout a no-op if already logged out
To prevent subsequent cli logouts from erroring in a loop Updates #3833 Signed-off-by: Irbe Krumina <[email protected]>
This commit is contained in:
1 parent
c19b5bfbc3
commit
dc057ff8fa
1 file changed
+10
-1
@@ -694,9 +694,18 @@ func (c *Auto) StartLogout() {
|
||||
func (c *Auto) Logout(ctx context.Context) error {
|
||||
c.logf("client.Logout()")
|
||||
|
||||
c.mu.Lock()
|
||||
// This happens if a user logs out when tailscale client is already logged
|
||||
// out either because the user logged out previously or hasn't yet logged
|
||||
// in.
|
||||
if !c.loggedIn {
|
||||
c.logf("client.Logout(): no action taken, client is already logged out.")
|
||||
c.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
errc := make(chan error, 1)
|
||||
|
||||
c.mu.Lock()
|
||||
c.loginGoal = &LoginGoal{
|
||||
wantLoggedIn: false,
|
||||
loggedOutResult: errc,
|
||||
|
||||
Reference in new issue
Block a user