code clean up in processAccountState()
This commit is contained in:
parent
928db01ae8
commit
a162d72c2a
|
@ -906,20 +906,17 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
private boolean processAccountState(Account account, boolean interactive, boolean isUiAction, boolean isAccountPushed, HashSet<Account> pingCandidates) {
|
||||
boolean pingNow = false;
|
||||
if (account.getStatus().isAttemptReconnect()) {
|
||||
if (!account.getStatus().isAttemptReconnect()) {
|
||||
return false;
|
||||
}
|
||||
if (!hasInternetConnection()) {
|
||||
account.setStatus(Account.State.NO_INTERNET);
|
||||
if (statusListener != null) {
|
||||
statusListener.onStatusChanged(account);
|
||||
}
|
||||
} else {
|
||||
if (account.getStatus() == Account.State.NO_INTERNET) {
|
||||
account.setStatus(Account.State.OFFLINE);
|
||||
if (statusListener != null) {
|
||||
statusListener.onStatusChanged(account);
|
||||
}
|
||||
}
|
||||
if (account.getStatus() == Account.State.ONLINE) {
|
||||
synchronized (mLowPingTimeoutMode) {
|
||||
long lastReceived = account.getXmppConnection().getLastPacketReceived();
|
||||
|
@ -939,12 +936,12 @@ public class XmppConnectionService extends Service {
|
|||
} else {
|
||||
pingCandidates.add(account);
|
||||
if (isAccountPushed) {
|
||||
pingNow = true;
|
||||
if (mLowPingTimeoutMode.add(account.getJid().asBareJid())) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": entering low ping timeout mode");
|
||||
}
|
||||
return true;
|
||||
} else if (msToNextPing <= 0) {
|
||||
pingNow = true;
|
||||
return true;
|
||||
} else {
|
||||
this.scheduleWakeUpCall((int) (msToNextPing / 1000), account.getUuid().hashCode());
|
||||
if (mLowPingTimeoutMode.remove(account.getJid().asBareJid())) {
|
||||
|
@ -977,8 +974,7 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pingNow;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void toggleSoftDisabled(final boolean softDisabled) {
|
||||
|
|
Loading…
Reference in a new issue