aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-01-25 20:52:53 +0100
committeriNPUTmice <daniel@gultsch.de>2015-01-25 20:52:53 +0100
commitf0d428a56d83e529825241510479aaed2ff9150b (patch)
tree341ea31522b66c59cfdbe68bd9dd13195721e0e9 /src/main/java/eu/siacs/conversations/services
parent4afdd6480a875dddbb0a24473ca2ec0af39c9826 (diff)
made connect time out more failsave
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index ca80fa84..a171de3d 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -436,11 +436,14 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
account.setXmppConnection(this.createConnection(account));
}
new Thread(account.getXmppConnection()).start();
- } else if ((account.getStatus() == Account.State.CONNECTING)
- && ((SystemClock.elapsedRealtime() - account
- .getXmppConnection().getLastConnect()) / 1000 >= Config.CONNECT_TIMEOUT)) {
- Log.d(Config.LOGTAG, account.getJid()+ ": time out during connect reconnecting");
- reconnectAccount(account, true);
+ } else if (account.getStatus() == Account.State.CONNECTING) {
+ long timeout = Config.CONNECT_TIMEOUT - ((SystemClock.elapsedRealtime() - account.getXmppConnection().getLastConnect()) / 1000);
+ if (timeout < 0) {
+ Log.d(Config.LOGTAG, account.getJid() + ": time out during connect reconnecting");
+ reconnectAccount(account, true);
+ } else {
+ scheduleWakeUpCall((int) timeout,account.getUuid().hashCode());
+ }
} else {
if (account.getXmppConnection().getTimeToNextAttempt() <= 0) {
reconnectAccount(account, true);