Skip to content

Commit

Permalink
fix: Reconnect after an error. (jitsi#1199)
Browse files Browse the repository at this point in the history
With Stream Management enabled ReconnectManager stops trying in some cases if the connection is closed with an error. We see that XMPPTCPConnection.connected=true in that case (TCP connection open, but an attempt to login fails).
  • Loading branch information
damencho authored Dec 5, 2024
1 parent 880d143 commit 584d686
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ class XmppProvider(val config: XmppConnectionConfig, parentLogger: Logger) {

override fun reconnectionFailed(e: Exception) {
logger.error("XMPP reconnection failed: ${e.message}", e)

if (xmppConnection.isConnected) {
xmppConnection.disconnect()

// If there was an error reconnecting, do not give up, let's retry
// if we retry too quickly and prosody is not fully up ('invalid-namespace' error)
connectRetry.runRetryingTask(
SimpleRetryTask(0, 1000L, true) {
doConnect()
}
)
}
}
}

Expand Down

0 comments on commit 584d686

Please sign in to comment.