aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-08-31 15:35:03 +0200
committerChristian Schneppe <christian@pix-art.de>2019-08-31 15:35:03 +0200
commit4323b7de5a6b1558587d73b3bf2220726e1c8efa (patch)
treef6849547cde80bb8e1e86ec2c4822650cb2ff2cc
parent240addee71f05e091f462a48dc9a590b070ccb61 (diff)
increased reconnection interval after policy violation
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 0cb1ee90b..596975cd1 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1438,6 +1438,7 @@ public class XmppConnection implements Runnable {
} else if (streamError.hasChild("host-unknown")) {
throw new StateChangingException(Account.State.HOST_UNKNOWN);
} else if (streamError.hasChild("policy-violation")) {
+ this.lastConnect = SystemClock.elapsedRealtime();
final String text = streamError.findChildContent("text");
if (text != null) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": policy violation. " + text);
@@ -1686,7 +1687,8 @@ public class XmppConnection implements Runnable {
}
public int getTimeToNextAttempt() {
- final int interval = Math.min((int) (25 * Math.pow(1.3, attempt)), 300);
+ final int additionalTime = account.getLastErrorStatus() == Account.State.POLICY_VIOLATION ? 3 : 0;
+ final int interval = Math.min((int) (25 * Math.pow(1.3, (additionalTime + attempt))), 300);
final int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000);
return interval - secondsSinceLast;
}