mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-27 10:47:35 +00:00
ipn/ipnlocal: use a switch statement instead of an else-if chain
For clarity. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
7421ba91ec
commit
0f4c0e558b
@ -2357,22 +2357,22 @@ func (b *LocalBackend) nextState() ipn.State {
|
|||||||
// Auth was interrupted or waiting for URL visit,
|
// Auth was interrupted or waiting for URL visit,
|
||||||
// so it won't proceed without human help.
|
// so it won't proceed without human help.
|
||||||
return ipn.NeedsLogin
|
return ipn.NeedsLogin
|
||||||
} else if state == ipn.Stopped {
|
}
|
||||||
|
switch state {
|
||||||
|
case ipn.Stopped:
|
||||||
// If we were already in the Stopped state, then
|
// If we were already in the Stopped state, then
|
||||||
// we can assume auth is in good shape (or we would
|
// we can assume auth is in good shape (or we would
|
||||||
// have been in NeedsLogin), so transition to Starting
|
// have been in NeedsLogin), so transition to Starting
|
||||||
// right away.
|
// right away.
|
||||||
return ipn.Starting
|
return ipn.Starting
|
||||||
} else if state == ipn.NoState {
|
case ipn.NoState:
|
||||||
// Our first time connecting to control, and we
|
// Our first time connecting to control, and we
|
||||||
// don't know if we'll NeedsLogin or not yet.
|
// don't know if we'll NeedsLogin or not yet.
|
||||||
// UIs should print "Loading..." in this state.
|
// UIs should print "Loading..." in this state.
|
||||||
return ipn.NoState
|
return ipn.NoState
|
||||||
} else if state == ipn.Starting ||
|
case ipn.Starting, ipn.Running, ipn.NeedsLogin:
|
||||||
state == ipn.Running ||
|
|
||||||
state == ipn.NeedsLogin {
|
|
||||||
return state
|
return state
|
||||||
} else {
|
default:
|
||||||
b.logf("unexpected no-netmap state transition for %v", state)
|
b.logf("unexpected no-netmap state transition for %v", state)
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user