aboutsummaryrefslogtreecommitdiff
path: root/telegram/commands.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/commands.go')
-rw-r--r--telegram/commands.go9
1 files changed, 6 insertions, 3 deletions
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
}