fix regression in ping strategy

This commit is contained in:
Daniel Gultsch 2023-01-22 16:13:16 +01:00
parent 8df97067bb
commit f982885d2e
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -267,7 +267,7 @@ public class ConnectionPool {
final long lastReceived = connection.getLastPacketReceived(); final long lastReceived = connection.getLastPacketReceived();
final long lastSent = connection.getLastPingSent(); final long lastSent = connection.getLastPingSent();
final long msToNextPing = final long msToNextPing =
(Math.max(lastReceived, lastSent) + Config.PING_MAX_INTERVAL) (Math.max(lastReceived, lastSent) + Config.PING_MAX_INTERVAL * 1000)
- SystemClock.elapsedRealtime(); - SystemClock.elapsedRealtime();
final int pingTimeout = final int pingTimeout =
lowPingTimeoutMode.contains(account.address) lowPingTimeoutMode.contains(account.address)
@ -280,8 +280,7 @@ public class ConnectionPool {
Log.d(Config.LOGTAG, account.address + ": ping timeout"); Log.d(Config.LOGTAG, account.address + ": ping timeout");
this.reconnectAccount(connection); this.reconnectAccount(connection);
} else { } else {
final int secs = (int) (pingTimeoutIn / 1000); this.scheduleWakeUpCall(Ints.saturatedCast(pingTimeoutIn / 1000));
this.scheduleWakeUpCall(secs);
} }
} else { } else {
pingCandidates.add(connection); pingCandidates.add(connection);