connector: Disconnect in a goroutine on auth error
If we get bad creds on initial connect the lock is being held when the callback is called.
This commit is contained in:
@@ -493,10 +493,12 @@ func (t *TelegramClient) onConnectionStateChange(reason string) func() {
|
|||||||
func (t *TelegramClient) onAuthError(err error) {
|
func (t *TelegramClient) onAuthError(err error) {
|
||||||
t.sendBadCredentialsOrUnknownError(err)
|
t.sendBadCredentialsOrUnknownError(err)
|
||||||
t.userLogin.Metadata.(*UserLoginMetadata).ResetOnLogout()
|
t.userLogin.Metadata.(*UserLoginMetadata).ResetOnLogout()
|
||||||
t.Disconnect()
|
go func() {
|
||||||
if err := t.userLogin.Save(context.Background()); err != nil {
|
t.Disconnect()
|
||||||
t.main.Bridge.Log.Err(err).Msg("failed to save user login")
|
if err := t.userLogin.Save(context.Background()); err != nil {
|
||||||
}
|
t.main.Bridge.Log.Err(err).Msg("failed to save user login")
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TelegramClient) Connect(ctx context.Context) {
|
func (t *TelegramClient) Connect(ctx context.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user