diff options
Diffstat (limited to 'telegram/connect.go')
-rw-r--r-- | telegram/connect.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/telegram/connect.go b/telegram/connect.go index 3827bcc..3a711c2 100644 --- a/telegram/connect.go +++ b/telegram/connect.go @@ -146,6 +146,7 @@ func (c *Client) Disconnect() { _, err := c.client.Close() if err != nil { log.Errorf("Couldn't close the Telegram instance: %v; %#v", err, c) + c.forceClose() } } @@ -198,13 +199,16 @@ func (c *Client) interactor() { } gateway.SendPresence(c.xmpp, c.jid, gateway.SPStatus("Logged in "+c.Session.Login)) - case client.TypeAuthorizationStateClosed: - log.Warn("Closing the updates listener") - c.listener.Close() + + return } } } +func (c *Client) forceClose() { + c.listener.Close() +} + // Online checks if the updates listener is alive func (c *Client) Online() bool { return c.listener != nil && c.listener.IsActive() |