From 55606240f6296ff8238164a6e510ee79722bf5c3 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 6 Sep 2022 13:05:31 +0200 Subject: State + FSM + Python: Rename the HAS_CONFIG state to DISCONNECTED --- state.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'state.go') diff --git a/state.go b/state.go index 884c871..2e0eb04 100644 --- a/state.go +++ b/state.go @@ -152,7 +152,7 @@ func (state *VPNState) getConfig( } // Signal the server display info - state.FSM.GoTransitionWithData(fsm.HAS_CONFIG, state.getServerInfoData(), false) + state.FSM.GoTransitionWithData(fsm.DISCONNECTED, state.getServerInfoData(), false) // Save the config state.Config.Save(&state) @@ -522,16 +522,16 @@ func (state *VPNState) SetDisconnecting() error { func (state *VPNState) SetDisconnected(cleanup bool) error { errorMessage := "failed to set disconnected" - if state.InFSMState(fsm.HAS_CONFIG) { + if state.InFSMState(fsm.DISCONNECTED) { // already disconnected, show no error return nil } - if !state.FSM.HasTransition(fsm.HAS_CONFIG) { + if !state.FSM.HasTransition(fsm.DISCONNECTED) { return &types.WrappedErrorMessage{ Message: errorMessage, Err: fsm.WrongStateTransitionError{ Got: state.FSM.Current, - Want: fsm.HAS_CONFIG, + Want: fsm.DISCONNECTED, }.CustomError(), } } @@ -555,7 +555,7 @@ func (state *VPNState) SetDisconnected(cleanup bool) error { server.Disconnect(currentServer) } - state.FSM.GoTransitionWithData(fsm.HAS_CONFIG, state.getServerInfoData(), false) + state.FSM.GoTransitionWithData(fsm.DISCONNECTED, state.getServerInfoData(), false) return nil } @@ -598,7 +598,7 @@ func (state *VPNState) RenewSession() error { } func (state *VPNState) ShouldRenewButton() bool { - if !state.InFSMState(fsm.CONNECTED) && !state.InFSMState(fsm.CONNECTING) && !state.InFSMState(fsm.HAS_CONFIG) && !state.InFSMState(fsm.DISCONNECTING) { + if !state.InFSMState(fsm.CONNECTED) && !state.InFSMState(fsm.CONNECTING) && !state.InFSMState(fsm.DISCONNECTED) && !state.InFSMState(fsm.DISCONNECTING) { return false } -- cgit v1.2.3