From 4323b7de5a6b1558587d73b3bf2220726e1c8efa Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 31 Aug 2019 15:35:03 +0200 Subject: increased reconnection interval after policy violation --- src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main') 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; } -- cgit v1.2.3