From d0f4303ee5ccecc876fdfae1ce858369e3a323b7 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 2 May 2023 13:06:50 +0200 Subject: Client + FSM: Check transitions and add SetState Also make sure GotConfig can be used to go back to --- exports/exports.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'exports') diff --git a/exports/exports.go b/exports/exports.go index ae741d7..5e62e4d 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -512,6 +512,17 @@ func StartFailover(c C.uintptr_t, gateway *C.char, mtu C.int, readRxBytes C.Read return droppedC, nil } +// SetState sets the state of the statemachine +// Note that this transitions the FSM into the new state without passing any data to it +//export SetState +func SetState(fsmState C.int) *C.char { + state, stateErr := getVPNState() + if stateErr != nil { + return getCError(stateErr) + } + return getCError(state.SetState(client.FSMStateID(fsmState))) +} + // FreeString frees a string that was allocated by the eduvpn-common Go library // This happens when we return strings, such as errors from the Go lib back to the client // The client MUST thus ensure that this memory is freed using this function -- cgit v1.2.3