summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-07-16 14:10:33 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-07-17 14:00:03 +0000
commitb173573d216e3554b64657a61bcd0b3e77cb977a (patch)
treed713a06f6baba60f4c724a1611fd68d6df97bb33
parent2fc994a73a1a50469c09544a17a2cbd9a6e8c67b (diff)
Client: Go to previous state on renew error
-rw-r--r--client/client.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/client/client.go b/client/client.go
index 9a26485..a50a111 100644
--- a/client/client.go
+++ b/client/client.go
@@ -627,11 +627,16 @@ func (c *Client) RenewSession(ck *cookie.Cookie) error {
return i18nerr.WrapInternal(err, "The current server could not be retrieved when renewing the session")
}
+ c.mu.Lock()
+ defer c.mu.Unlock()
+ previousState := c.FSM.Current
+
// getting a server with no tokens means re-authorize
disco, release := c.discoMan.Discovery(true)
defer release()
_, err = srv.ServerWithCallbacks(ck.Context(), disco, nil, false)
if err != nil {
+ c.FSM.GoTransition(previousState)
return i18nerr.WrapInternal(err, "The server was unable to be retrieved when renewing the session")
}
return nil