diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-03-14 11:59:28 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-03-14 11:59:28 +0100 |
| commit | c1c2011ec83553a2de7661f89383be4b29883db6 (patch) | |
| tree | 90bb733770307732d8548274e883b76382df9254 /client | |
| parent | 44a06427f1d3a5c088f9c0dc0ec813a5db227888 (diff) | |
Client: Fix previous state not being set correctly on config error
Diffstat (limited to 'client')
| -rw-r--r-- | client/client.go | 5 |
1 files changed, 2 insertions, 3 deletions
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) } |
