From d8c7f962e4fe2d4a46f0aeb1c9d9a371d5e41ee0 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Fri, 19 Aug 2022 16:32:35 +0200 Subject: State + FSM: Properly handle the disconnect flow - /disconnect is now called - A new state is added (DISCONNECTING) that waits for the disconnect to complete - A helper function is exposed (InFSMState) that can be used by clients to see in which state they are in --- wrappers/python/src/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'wrappers/python/src/main.py') diff --git a/wrappers/python/src/main.py b/wrappers/python/src/main.py index 8440c7d..574d0e2 100644 --- a/wrappers/python/src/main.py +++ b/wrappers/python/src/main.py @@ -145,6 +145,12 @@ class EduVPN(object): if connect_err: raise Exception(connect_err) + def set_disconnecting(self) -> None: + disconnecting_err = self.go_function(lib.SetDisconnecting) + + if disconnecting_err: + raise Exception(disconnecting_err) + def set_connecting(self) -> None: connecting_err = self.go_function(lib.SetConnecting) @@ -216,3 +222,6 @@ class EduVPN(object): def should_renew_button(self) -> bool: return self.go_function(lib.ShouldRenewButton) + + def in_fsm_state(self, state_id: State) -> bool: + return self.go_function(lib.InFSMState, state_id) -- cgit v1.2.3