From 4873ed77ff46bad274d642ca4d6b50686939f62f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 12 Dec 2025 17:25:04 +0200 Subject: [PATCH] client: disconnect on auth error --- pkg/connector/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/connector/client.go b/pkg/connector/client.go index 60e574cf..1b81f6b7 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -432,7 +432,7 @@ func (t *TelegramClient) onPing() { me, err := t.client.Self(ctx) if auth.IsUnauthorized(err) { - t.onAuthError(fmt.Errorf("not logged in")) + t.onAuthError(err) } else if errors.Is(err, syscall.EPIPE) { // This is a pipe error, try disconnecting which will force the // updatesManager to fail and cause the client to reconnect. @@ -510,6 +510,7 @@ func (t *TelegramClient) onAuthError(err error) { t.sendBadCredentialsOrUnknownError(err) t.metadata.ResetOnLogout() go func() { + t.Disconnect() if err := t.userLogin.Save(context.Background()); err != nil { t.main.Bridge.Log.Err(err).Msg("failed to save user login") }