From 65fcf712d3e2b098cfd415e33ffd2ef845caf647 Mon Sep 17 00:00:00 2001 From: Gerardo Rodriguez Date: Fri, 24 Apr 2026 06:58:43 -0400 Subject: [PATCH] client: treat pool.ErrConnDead as transient in onPing (#1066) --- pkg/connector/client.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/connector/client.go b/pkg/connector/client.go index a6110478..f466c926 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -47,6 +47,7 @@ import ( "go.mau.fi/mautrix-telegram/pkg/connector/matrixfmt" "go.mau.fi/mautrix-telegram/pkg/connector/store" "go.mau.fi/mautrix-telegram/pkg/connector/telegramfmt" + "go.mau.fi/mautrix-telegram/pkg/gotd/pool" "go.mau.fi/mautrix-telegram/pkg/gotd/telegram" "go.mau.fi/mautrix-telegram/pkg/gotd/telegram/auth" "go.mau.fi/mautrix-telegram/pkg/gotd/telegram/updates" @@ -422,12 +423,12 @@ func (tc *TelegramClient) onPing() { me, err := tc.client.Self(ctx) if auth.IsUnauthorized(err) { tc.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. + } else if errors.Is(err, syscall.EPIPE) || errors.Is(err, pool.ErrConnDead) { + // Connectivity error — connection died during the Self() call. + // Keep as transient; gotd's backoff will reconnect. tc.userLogin.BridgeState.Send(status.BridgeState{ StateEvent: status.StateTransientDisconnect, - Error: "pipe-error", + Error: "connectivity-error", Message: humanise.Error(err), }) } else if err != nil {