~singpolyma/cheogram-android

3804dc21a20eba112b255463dcc342aa0bf18fd3 — Stephen Paul Weber 6 months ago 9c06087
Ping all online MUCs every second max ping interval
1 files changed, 10 insertions(+), 0 deletions(-)

M src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
M src/main/java/eu/siacs/conversations/services/XmppConnectionService.java => src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +10 -0
@@ 230,6 230,7 @@ public class XmppConnectionService extends Service {
    public DatabaseBackend databaseBackend;
    private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger");
    private long mLastActivity = 0;
    private long mLastMucPing = 0;
    private final FileBackend fileBackend = new FileBackend(this);
    private MemorizingTrustManager mMemorizingTrustManager;
    private final NotificationService mNotificationService = new NotificationService(this);


@@ 921,6 922,15 @@ public class XmppConnectionService extends Service {
                    Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + lowTimeout + ")");
                    scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode());
                }
                long msToMucPing = (mLastMucPing + (Config.PING_MAX_INTERVAL * 2000L)) - SystemClock.elapsedRealtime();
                if (msToMucPing <= 0) {
                    mLastMucPing = SystemClock.elapsedRealtime();
                    for (Conversation c : getConversations()) {
                        if (c.getMode() == Conversation.MODE_MULTI && c.getMucOptions().online()) {
                            mucSelfPingAndRejoin(c);
                        }
                    }
                }
            }
            WakeLockHelper.release(wakeLock);
        }