Ping MUCs more aggressively
Stephen Paul Weber
created 10 months ago
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.
Change summary
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 16
1 file changed, 8 insertions(+), 8 deletions(-)
Detailed changes
@@ -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);
}
}
}