From 242903aa810797102b14e27dda988fff7ab833cc Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 11 Oct 2022 15:27:46 +0200 Subject: Client + Server: Set the current institute / custom server on adding --- client.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'client.go') diff --git a/client.go b/client.go index 5745d97..6aa9a3a 100644 --- a/client.go +++ b/client.go @@ -604,6 +604,12 @@ func (client *Client) GetConfigInstituteAccess(url string, preferTCP bool) (stri return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr} } + // Set the server as the current + currentErr := client.Servers.SetInstituteAccess(server) + if currentErr != nil { + return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: currentErr} + } + // The server has now been chosen client.FSM.GoTransition(STATE_CHOSEN_SERVER) @@ -651,6 +657,12 @@ func (client *Client) GetConfigSecureInternet( return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr} } + // Set the server as the current + currentErr := client.Servers.SetSecureInternet(server) + if currentErr != nil { + return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: currentErr} + } + client.FSM.GoTransition(STATE_CHOSEN_SERVER) config, configType, configErr := client.getConfig(server, preferTCP) @@ -693,6 +705,12 @@ func (client *Client) GetConfigCustomServer(url string, preferTCP bool) (string, return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr} } + // Set the server as the current + currentErr := client.Servers.SetCustomServer(server) + if currentErr != nil { + return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: currentErr} + } + client.FSM.GoTransition(STATE_CHOSEN_SERVER) config, configType, configErr := client.getConfig(server, preferTCP) -- cgit v1.2.3