aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-09-01 01:24:30 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-09-01 01:24:30 +0300
commit282a6fc21b9626ab1bdc9c5a78162d90b7d28aa2 (patch)
tree10dd90f60829e42b1002f1f3997ed091c8a14dd9
parent4588170d1e43db780c551177f5996598fe25bc6e (diff)
Hotfix: prevent lockup on loginv1.8.2
-rw-r--r--Makefile2
-rw-r--r--telegabber.go2
-rw-r--r--telegram/commands.go9
-rw-r--r--telegram/connect.go5
4 files changed, 11 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index e139c00..5c001af 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
COMMIT := $(shell git rev-parse --short HEAD)
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
-VERSION := "v1.8.1"
+VERSION := "v1.8.2"
MAKEOPTS := "-j4"
all:
diff --git a/telegabber.go b/telegabber.go
index 85c5fbd..a1efd12 100644
--- a/telegabber.go
+++ b/telegabber.go
@@ -15,7 +15,7 @@ import (
goxmpp "gosrc.io/xmpp"
)
-var version string = "1.8.1"
+var version string = "1.8.2"
var commit string
var sm *goxmpp.StreamManager
diff --git a/telegram/commands.go b/telegram/commands.go
index b729973..87fff72 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -244,17 +244,20 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string
return notEnoughArguments
}
- c.locks.authorizerWriteLock.Lock()
- defer c.locks.authorizerWriteLock.Unlock()
-
if cmd == "login" {
err := c.TryLogin(resource, args[0])
if err != nil {
return err.Error()
}
+ c.locks.authorizerWriteLock.Lock()
+ defer c.locks.authorizerWriteLock.Unlock()
+
c.authorizer.PhoneNumber <- args[0]
} else {
+ c.locks.authorizerWriteLock.Lock()
+ defer c.locks.authorizerWriteLock.Unlock()
+
if c.authorizer == nil {
return TelegramNotInitialized
}
diff --git a/telegram/connect.go b/telegram/connect.go
index 6c49aa9..b1b8b10 100644
--- a/telegram/connect.go
+++ b/telegram/connect.go
@@ -122,6 +122,7 @@ func (c *Client) Connect(resource string) error {
}
go c.interactor()
+ log.Warn("Interactor launched")
c.authorizer.TdlibParameters <- c.parameters
c.locks.authorizerWriteLock.Unlock()
@@ -180,8 +181,8 @@ func (c *Client) TryLogin(resource string, login string) error {
time.Sleep(1e5)
}
- c.locks.authorizerReadLock.Lock()
- defer c.locks.authorizerReadLock.Unlock()
+ c.locks.authorizerWriteLock.Lock()
+ defer c.locks.authorizerWriteLock.Unlock()
if c.authorizer == nil {
return errors.New(TelegramNotInitialized)