don't reset last connect time on network change
This commit is contained in:
parent
a7ee8f8a74
commit
1ed2445c1d
|
@ -547,7 +547,7 @@ public class XmppConnectionService extends Service {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ConnectivityManager.CONNECTIVITY_ACTION:
|
case ConnectivityManager.CONNECTIVITY_ACTION:
|
||||||
if (hasInternetConnection() && Config.RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE) {
|
if (hasInternetConnection() && Config.RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE) {
|
||||||
resetAllAttemptCounts(true);
|
resetAllAttemptCounts(true, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_MERGE_PHONE_CONTACTS:
|
case ACTION_MERGE_PHONE_CONTACTS:
|
||||||
|
@ -573,7 +573,7 @@ public class XmppConnectionService extends Service {
|
||||||
dismissErrorNotifications();
|
dismissErrorNotifications();
|
||||||
break;
|
break;
|
||||||
case ACTION_TRY_AGAIN:
|
case ACTION_TRY_AGAIN:
|
||||||
resetAllAttemptCounts(false);
|
resetAllAttemptCounts(false, true);
|
||||||
interactive = true;
|
interactive = true;
|
||||||
break;
|
break;
|
||||||
case ACTION_REPLY_TO_CONVERSATION:
|
case ACTION_REPLY_TO_CONVERSATION:
|
||||||
|
@ -672,7 +672,7 @@ public class XmppConnectionService extends Service {
|
||||||
long timeout = Config.CONNECT_TIMEOUT - secondsSinceLastConnect;
|
long timeout = Config.CONNECT_TIMEOUT - secondsSinceLastConnect;
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
Log.d(Config.LOGTAG, account.getJid() + ": time out during connect reconnecting");
|
Log.d(Config.LOGTAG, account.getJid() + ": time out during connect reconnecting");
|
||||||
account.getXmppConnection().resetAttemptCount();
|
account.getXmppConnection().resetAttemptCount(false);
|
||||||
reconnectAccount(account, true, interactive);
|
reconnectAccount(account, true, interactive);
|
||||||
} else if (discoTimeout < 0) {
|
} else if (discoTimeout < 0) {
|
||||||
account.getXmppConnection().sendDiscoTimeout();
|
account.getXmppConnection().sendDiscoTimeout();
|
||||||
|
@ -814,13 +814,13 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetAllAttemptCounts(boolean reallyAll) {
|
private void resetAllAttemptCounts(boolean reallyAll, boolean retryImmediately) {
|
||||||
Log.d(Config.LOGTAG, "resetting all attempt counts");
|
Log.d(Config.LOGTAG, "resetting all attempt counts");
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
if (account.hasErrorStatus() || reallyAll) {
|
if (account.hasErrorStatus() || reallyAll) {
|
||||||
final XmppConnection connection = account.getXmppConnection();
|
final XmppConnection connection = account.getXmppConnection();
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.resetAttemptCount();
|
connection.resetAttemptCount(retryImmediately);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (account.setShowErrorNotification(true)) {
|
if (account.setShowErrorNotification(true)) {
|
||||||
|
|
|
@ -1526,10 +1526,12 @@ public class XmppConnection implements Runnable {
|
||||||
this.sendPacket(new InactivePacket());
|
this.sendPacket(new InactivePacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetAttemptCount() {
|
public void resetAttemptCount(boolean resetConnectTime) {
|
||||||
this.attempt = 0;
|
this.attempt = 0;
|
||||||
|
if (resetConnectTime) {
|
||||||
this.lastConnect = 0;
|
this.lastConnect = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setInteractive(boolean interactive) {
|
public void setInteractive(boolean interactive) {
|
||||||
this.mInteractive = interactive;
|
this.mInteractive = interactive;
|
||||||
|
|
Loading…
Reference in New Issue