Avoid broken state on a failed logout attempt

This commit is contained in:
Bohdan Horbeshko 2024-03-29 07:35:06 -04:00
parent f56e6ac187
commit 67c38823f2

View file

@ -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":