diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-06 13:05:31 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-06 13:05:31 +0200 |
| commit | 55606240f6296ff8238164a6e510ee79722bf5c3 (patch) | |
| tree | 1bfb729985093d975c94302a9be43552e2078bfb /internal | |
| parent | efe37d710cbc8097b02f06e3350f0e8467a23058 (diff) | |
State + FSM + Python: Rename the HAS_CONFIG state to DISCONNECTED
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/fsm/fsm.go | 20 | ||||
| -rw-r--r-- | internal/server/common.go | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/internal/fsm/fsm.go b/internal/fsm/fsm.go index 74acc50..6178af9 100644 --- a/internal/fsm/fsm.go +++ b/internal/fsm/fsm.go @@ -59,8 +59,8 @@ const ( // Ask profile means the go code is asking for a profile selection from the UI ASK_PROFILE - // Has config means the user has gotten a config - HAS_CONFIG + // Disconnected means the user has gotten a config for a server but is not connected yet + DISCONNECTED // Disconnecting means the OS is disconnecting and the Go code is doing the /disconnect DISCONNECTING @@ -88,8 +88,8 @@ func (s FSMStateID) String() string { return "Chosen_Server" case OAUTH_STARTED: return "OAuth_Started" - case HAS_CONFIG: - return "Has_Config" + case DISCONNECTED: + return "Disconnected" case REQUEST_CONFIG: return "Request_Config" case ASK_PROFILE: @@ -199,19 +199,19 @@ func (fsm *FSM) Init( REQUEST_CONFIG: FSMState{ Transitions: []FSMTransition{ {ASK_PROFILE, "Multiple profiles found and no profile chosen"}, - {HAS_CONFIG, "Only one profile or profile already chosen"}, + {DISCONNECTED, "Only one profile or profile already chosen"}, {NO_SERVER, "Cancel or Error"}, {OAUTH_STARTED, "Re-authorize"}, }, }, ASK_PROFILE: FSMState{ Transitions: []FSMTransition{ - {HAS_CONFIG, "User chooses profile"}, + {DISCONNECTED, "User chooses profile"}, {NO_SERVER, "Cancel or Error"}, {SEARCH_SERVER, "Cancel or Error"}, }, }, - HAS_CONFIG: FSMState{ + DISCONNECTED: FSMState{ Transitions: []FSMTransition{ {CONNECTING, "OS reports it is trying to connect"}, {REQUEST_CONFIG, "User reconnects"}, @@ -222,13 +222,13 @@ func (fsm *FSM) Init( }, DISCONNECTING: FSMState{ Transitions: []FSMTransition{ - {HAS_CONFIG, "Cancel or Error"}, - {HAS_CONFIG, "Done disconnecting"}, + {DISCONNECTED, "Cancel or Error"}, + {DISCONNECTED, "Done disconnecting"}, }, }, CONNECTING: FSMState{ Transitions: []FSMTransition{ - {HAS_CONFIG, "Cancel or Error"}, + {DISCONNECTED, "Cancel or Error"}, {CONNECTED, "Done connecting"}, }, }, diff --git a/internal/server/common.go b/internal/server/common.go index f6bf67d..c1ce074 100644 --- a/internal/server/common.go +++ b/internal/server/common.go @@ -473,12 +473,12 @@ func getConfigWithProfile(server Server, forceTCP bool) (string, string, error) if baseErr != nil { return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: baseErr} } - if !base.FSM.HasTransition(fsm.HAS_CONFIG) { + if !base.FSM.HasTransition(fsm.DISCONNECTED) { return "", "", &types.WrappedErrorMessage{ Message: errorMessage, Err: fsm.WrongStateTransitionError{ Got: base.FSM.Current, - Want: fsm.HAS_CONFIG, + Want: fsm.DISCONNECTED, }.CustomError(), } } |
