client: treat pool.ErrConnDead as transient in onPing (#1066)
This commit is contained in:
committed by
GitHub
parent
8512cfe6a6
commit
65fcf712d3
@@ -47,6 +47,7 @@ import (
|
|||||||
"go.mau.fi/mautrix-telegram/pkg/connector/matrixfmt"
|
"go.mau.fi/mautrix-telegram/pkg/connector/matrixfmt"
|
||||||
"go.mau.fi/mautrix-telegram/pkg/connector/store"
|
"go.mau.fi/mautrix-telegram/pkg/connector/store"
|
||||||
"go.mau.fi/mautrix-telegram/pkg/connector/telegramfmt"
|
"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"
|
||||||
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/auth"
|
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/auth"
|
||||||
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/updates"
|
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/updates"
|
||||||
@@ -422,12 +423,12 @@ func (tc *TelegramClient) onPing() {
|
|||||||
me, err := tc.client.Self(ctx)
|
me, err := tc.client.Self(ctx)
|
||||||
if auth.IsUnauthorized(err) {
|
if auth.IsUnauthorized(err) {
|
||||||
tc.onAuthError(err)
|
tc.onAuthError(err)
|
||||||
} else if errors.Is(err, syscall.EPIPE) {
|
} else if errors.Is(err, syscall.EPIPE) || errors.Is(err, pool.ErrConnDead) {
|
||||||
// This is a pipe error, try disconnecting which will force the
|
// Connectivity error — connection died during the Self() call.
|
||||||
// updatesManager to fail and cause the client to reconnect.
|
// Keep as transient; gotd's backoff will reconnect.
|
||||||
tc.userLogin.BridgeState.Send(status.BridgeState{
|
tc.userLogin.BridgeState.Send(status.BridgeState{
|
||||||
StateEvent: status.StateTransientDisconnect,
|
StateEvent: status.StateTransientDisconnect,
|
||||||
Error: "pipe-error",
|
Error: "connectivity-error",
|
||||||
Message: humanise.Error(err),
|
Message: humanise.Error(err),
|
||||||
})
|
})
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user