summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-03-14 11:59:28 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2024-03-14 11:59:28 +0100
commitc1c2011ec83553a2de7661f89383be4b29883db6 (patch)
tree90bb733770307732d8548274e883b76382df9254
parent44a06427f1d3a5c088f9c0dc0ec813a5db227888 (diff)
Client: Fix previous state not being set correctly on config error
-rw-r--r--CHANGES.md1
-rw-r--r--client/client.go5
2 files changed, 3 insertions, 3 deletions
diff --git a/CHANGES.md b/CHANGES.md
index fb6c828..42f4150 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,7 @@
# Not released
* Expose default gateway in profile settings too. For clients, use the default gateway set on the config object, this is maybe only useful for suggesting some profiles in the client profile chooser UI
* Add a server internally before authorizing and remove it again if authorization has failed. This makes sure the internal state is always up-to-date with what is happening. This also allows us to move to the main state when authorization is done as previously it could be the case where authorization was done but the server was not added yet
+* Fix previous state not being set correctly when getting a config and an error happens
# 1.99.1 (2024-03-11)
* Disable type annotation for global eduVPN class as it gave a `SyntaxError` on some Python versions. See https://bugs.python.org/issue34939
diff --git a/client/client.go b/client/client.go
index 7cf1e8b..d97d6e0 100644
--- a/client/client.go
+++ b/client/client.go
@@ -372,11 +372,10 @@ func (c *Client) convertIdentifier(identifier string, t srvtypes.Type) (string,
}
// GetConfig gets a VPN configuration
-func (c *Client) GetConfig(ck *cookie.Cookie, identifier string, _type srvtypes.Type, pTCP bool, startup bool) (*srvtypes.Configuration, error) {
+func (c *Client) GetConfig(ck *cookie.Cookie, identifier string, _type srvtypes.Type, pTCP bool, startup bool) (cfg *srvtypes.Configuration, err error) {
c.mu.Lock()
defer c.mu.Unlock()
previousState := c.FSM.Current
- var err error
defer func() {
if err == nil {
@@ -431,7 +430,7 @@ func (c *Client) GetConfig(ck *cookie.Cookie, identifier string, _type srvtypes.
return nil, i18nerr.Wrapf(err, "Server: '%s' could not be connected to", identifier)
}
- cfg, err := c.Servers.ConnectWithCallbacks(ck.Context(), srv, pTCP)
+ cfg, err = c.Servers.ConnectWithCallbacks(ck.Context(), srv, pTCP)
if err != nil {
return nil, i18nerr.Wrapf(err, "No VPN configuration for server: '%s' could be obtained", identifier)
}