From 67c38823f2b053928c6c0a5a13261b891e9db4d3 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Fri, 29 Mar 2024 07:35:06 -0400 Subject: [PATCH] Avoid broken state on a failed logout attempt --- telegram/commands.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/telegram/commands.go b/telegram/commands.go index 9251ebb..d9dc1f2 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -279,16 +279,15 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string return notOnline } - for _, id := range c.cache.ChatsKeys() { - c.unsubscribe(id) - } - _, err := c.client.LogOut() if err != nil { - c.forceClose() return errors.Wrap(err, "Logout error").Error() } + for _, id := range c.cache.ChatsKeys() { + c.unsubscribe(id) + } + c.Session.Login = "" // cancel auth case "cancelauth":