From c1c2011ec83553a2de7661f89383be4b29883db6 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 14 Mar 2024 11:59:28 +0100 Subject: Client: Fix previous state not being set correctly on config error --- client/client.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'client') 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) } -- cgit v1.2.3