use aggressive reconnects for see-other-host

This commit is contained in:
Daniel Gultsch 2023-10-20 09:39:25 +02:00
parent 1732ab5cc7
commit e422b89df5
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -475,7 +475,8 @@ public class XmppConnectionService extends Service {
} else if (account.getStatus() != Account.State.CONNECTING && account.getStatus() != Account.State.NO_INTERNET) {
resetSendingToWaiting(account);
if (connection != null && account.getStatus().isAttemptReconnect()) {
final boolean aggressive = hasJingleRtpConnection(account);
final boolean aggressive = account.getStatus() == Account.State.SEE_OTHER_HOST
|| hasJingleRtpConnection(account);
final int next = connection.getTimeToNextAttempt(aggressive);
final boolean lowPingTimeoutMode = isInLowPingTimeoutMode(account);
if (next <= 0) {
@ -485,6 +486,13 @@ public class XmppConnectionService extends Service {
final int attempt = connection.getAttempt() + 1;
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error connecting account. try again in " + next + "s for the " + attempt + " time. lowPingTimeout=" + lowPingTimeoutMode+", aggressive="+aggressive);
scheduleWakeUpCall(next, account.getUuid().hashCode());
if (aggressive) {
internalPingExecutor.schedule(
XmppConnectionService.this::manageAccountConnectionStatesInternal,
(next * 1000L) + 50,
TimeUnit.MILLISECONDS
);
}
}
}
}
@ -976,7 +984,7 @@ public class XmppConnectionService extends Service {
scheduleWakeUpCall((int) Math.min(timeout, discoTimeout), account.getUuid().hashCode());
}
} else {
final boolean aggressive = hasJingleRtpConnection(account);
final boolean aggressive = account.getStatus() == Account.State.SEE_OTHER_HOST || hasJingleRtpConnection(account);
if (account.getXmppConnection().getTimeToNextAttempt(aggressive) <= 0) {
reconnectAccount(account, true, interactive);
}