aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-10-29 19:43:10 +0100
committerChristian Schneppe <christian@pix-art.de>2017-10-29 19:43:10 +0100
commitb021688417c10ff1cbfacfff333780bf39f92512 (patch)
tree63a462778cecbde26b660bc86806c3814b0158bc /src/main/java/de/pixart/messenger/xmpp
parent5059c7b46b1f988ae81c76cf303498e8a8d5b75f (diff)
XmppConnection: do not count stanzas before smacks session has started
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java10
1 files changed, 9 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 04d9c96c5..ab1b5ab0c 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -110,6 +110,7 @@ public class XmppConnection implements Runnable {
private final Features features = new Features(this);
private boolean needsBinding = true;
private boolean shouldAuthenticate = true;
+ private boolean inSmacksSession = false;
private Element streamFeatures;
private final HashMap<Jid, ServiceDiscoveryResult> disco = new HashMap<>();
@@ -281,6 +282,7 @@ public class XmppConnection implements Runnable {
}
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": connecting");
features.encryptionEnabled = false;
+ inSmacksSession = false;
this.attempt++;
this.verifiedHostname = null; //will be set if user entered hostname is being used or hostname was verified with dnssec
try {
@@ -607,9 +609,11 @@ public class XmppConnection implements Runnable {
+ ": stream management(" + smVersion + ") enabled");
}
this.stanzasReceived = 0;
+ this.inSmacksSession = true;
final RequestPacket r = new RequestPacket(smVersion);
tagWriter.writeStanzaAsync(r);
} else if (nextTag.isStart("resumed")) {
+ this.inSmacksSession = true;
this.tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
lastPacketReceived = SystemClock.elapsedRealtime();
final Element resumed = tagReader.readElement(nextTag);
@@ -762,7 +766,11 @@ public class XmppConnection implements Runnable {
resetStreamId();
throw new IOException("time to restart the session. cant handle >2 billion pcks");
}
- ++stanzasReceived;
+ if (inSmacksSession) {
+ ++stanzasReceived;
+ } else if (features.sm()) {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": not counting stanza(" + element.getClass().getSimpleName() + "). Not in smacks session.");
+ }
lastPacketReceived = SystemClock.elapsedRealtime();
if (Config.BACKGROUND_STANZA_LOGGING && mXmppConnectionService.checkListeners()) {
Log.d(Config.LOGTAG, "[background stanza] " + element);