From 2e09e8c386094fb03d6eb20fb26e911afdc499b3 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 22 Apr 2025 13:04:19 -0500 Subject: [PATCH] Ping MUCs more aggressively If we get any inbound stanza, that resets the connection ping timer, but this is not reasonable for MUC pings since the remote MUC may have had an issue separate from our connection. --- .../services/XmppConnectionService.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 25d7babbed697e9790e8ee01f4b627acc223acd8..6dd42cc5f418ca7223b8f856cec83de2b6c85e88 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1249,14 +1249,14 @@ public class XmppConnectionService extends Service { lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode()); } - long msToMucPing = (mLastMucPing + (Config.PING_MAX_INTERVAL * 2000L)) - SystemClock.elapsedRealtime(); - if (msToMucPing <= 0) { - Log.d(Config.LOGTAG, "ping MUCs"); - mLastMucPing = SystemClock.elapsedRealtime(); - for (Conversation c : getConversations()) { - if (c.getMode() == Conversation.MODE_MULTI && (c.getMucOptions().online() || c.getMucOptions().getError() == MucOptions.Error.SHUTDOWN)) { - mucSelfPingAndRejoin(c); - } + } + long msToMucPing = (mLastMucPing + (Config.PING_MAX_INTERVAL * 2000L)) - SystemClock.elapsedRealtime(); + if (pingNow || ("ui".equals(action) && msToMucPing <= 0) || msToMucPing < -300000) { + Log.d(Config.LOGTAG, "ping MUCs"); + mLastMucPing = SystemClock.elapsedRealtime(); + for (Conversation c : getConversations()) { + if (c.getMode() == Conversation.MODE_MULTI && (c.getMucOptions().online() || c.getMucOptions().getError() == MucOptions.Error.SHUTDOWN)) { + mucSelfPingAndRejoin(c); } } }