aboutsummaryrefslogtreecommitdiff
path: root/telegram/connect.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-19 23:29:36 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-19 23:29:36 +0300
commitab914b0ff764de13d5496a12a1315c72dd3376fc (patch)
tree665ce28f6ee101b7c58121390dcae217e57e8786 /telegram/connect.go
parent18b5bc09356dd80024ecfd411145b3312b3fa7a1 (diff)
More relogin fixes, prevent crashing by commands when offline
Diffstat (limited to 'telegram/connect.go')
-rw-r--r--telegram/connect.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/telegram/connect.go b/telegram/connect.go
index af97b02..3a5a91f 100644
--- a/telegram/connect.go
+++ b/telegram/connect.go
@@ -118,6 +118,7 @@ func (c *Client) Connect() error {
c.client = tdlibClient
c.listener = tdlibClient.GetListener()
c.locks.authorizationReady.Done()
+ c.online = true
go c.updateHandler()
@@ -206,11 +207,12 @@ func (c *Client) interactor() {
}
func (c *Client) forceClose() {
- c.listener.Close()
+ //c.listener.Close()
+ c.online = false
c.authorizer = nil
}
// Online checks if the updates listener is alive
func (c *Client) Online() bool {
- return c.listener != nil && c.listener.IsActive()
+ return c.listener != nil && c.online //c.listener.IsActive()
}