Hotfix: prevent lockup on login
This commit is contained in:
parent
4588170d1e
commit
282a6fc21b
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
COMMIT := $(shell git rev-parse --short HEAD)
|
COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
|
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
|
||||||
VERSION := "v1.8.1"
|
VERSION := "v1.8.2"
|
||||||
MAKEOPTS := "-j4"
|
MAKEOPTS := "-j4"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
goxmpp "gosrc.io/xmpp"
|
goxmpp "gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string = "1.8.1"
|
var version string = "1.8.2"
|
||||||
var commit string
|
var commit string
|
||||||
|
|
||||||
var sm *goxmpp.StreamManager
|
var sm *goxmpp.StreamManager
|
||||||
|
|
|
@ -244,17 +244,20 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string
|
||||||
return notEnoughArguments
|
return notEnoughArguments
|
||||||
}
|
}
|
||||||
|
|
||||||
c.locks.authorizerWriteLock.Lock()
|
|
||||||
defer c.locks.authorizerWriteLock.Unlock()
|
|
||||||
|
|
||||||
if cmd == "login" {
|
if cmd == "login" {
|
||||||
err := c.TryLogin(resource, args[0])
|
err := c.TryLogin(resource, args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err.Error()
|
return err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.locks.authorizerWriteLock.Lock()
|
||||||
|
defer c.locks.authorizerWriteLock.Unlock()
|
||||||
|
|
||||||
c.authorizer.PhoneNumber <- args[0]
|
c.authorizer.PhoneNumber <- args[0]
|
||||||
} else {
|
} else {
|
||||||
|
c.locks.authorizerWriteLock.Lock()
|
||||||
|
defer c.locks.authorizerWriteLock.Unlock()
|
||||||
|
|
||||||
if c.authorizer == nil {
|
if c.authorizer == nil {
|
||||||
return TelegramNotInitialized
|
return TelegramNotInitialized
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,7 @@ func (c *Client) Connect(resource string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
go c.interactor()
|
go c.interactor()
|
||||||
|
log.Warn("Interactor launched")
|
||||||
|
|
||||||
c.authorizer.TdlibParameters <- c.parameters
|
c.authorizer.TdlibParameters <- c.parameters
|
||||||
c.locks.authorizerWriteLock.Unlock()
|
c.locks.authorizerWriteLock.Unlock()
|
||||||
|
@ -180,8 +181,8 @@ func (c *Client) TryLogin(resource string, login string) error {
|
||||||
time.Sleep(1e5)
|
time.Sleep(1e5)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.locks.authorizerReadLock.Lock()
|
c.locks.authorizerWriteLock.Lock()
|
||||||
defer c.locks.authorizerReadLock.Unlock()
|
defer c.locks.authorizerWriteLock.Unlock()
|
||||||
|
|
||||||
if c.authorizer == nil {
|
if c.authorizer == nil {
|
||||||
return errors.New(TelegramNotInitialized)
|
return errors.New(TelegramNotInitialized)
|
||||||
|
|
Loading…
Reference in a new issue