aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-06-22 12:21:33 +0200
committerChristian Schneppe <christian@pix-art.de>2016-06-22 20:41:37 +0200
commit4c8a3ae4f5b65009b9be6b1e9d8c4c445713e859 (patch)
tree31cc5e4911a1c8ed5d3edf6b16ac8e90792e4d28 /src
parent392a754b44c35a51b70a79c0a1a265d5769c365f (diff)
synchronize stanza count increment and write
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 838bcd797..0bf62e342 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -1037,9 +1037,9 @@ public class XmppConnection implements Runnable {
smVersion = 2;
}
if (smVersion != 0) {
- final EnablePacket enable = new EnablePacket(smVersion);
- tagWriter.writeStanzaAsync(enable);
synchronized (this.mStanzaQueue) {
+ final EnablePacket enable = new EnablePacket(smVersion);
+ tagWriter.writeStanzaAsync(enable);
stanzasSent = 0;
mStanzaQueue.clear();
}
@@ -1274,18 +1274,18 @@ public class XmppConnection implements Runnable {
disconnect(true);
return;
}
- tagWriter.writeStanzaAsync(packet);
- if (packet instanceof AbstractAcknowledgeableStanza) {
- AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
- synchronized (this.mStanzaQueue) {
+ synchronized (this.mStanzaQueue) {
+ tagWriter.writeStanzaAsync(packet);
+ if (packet instanceof AbstractAcknowledgeableStanza) {
+ AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
++stanzasSent;
this.mStanzaQueue.append(stanzasSent, stanza);
- }
- if (stanza instanceof MessagePacket && stanza.getId() != null && getFeatures().sm()) {
- if (Config.EXTENDED_SM_LOGGING) {
- Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": requesting ack for message stanza #" + stanzasSent);
+ if (stanza instanceof MessagePacket && stanza.getId() != null && getFeatures().sm()) {
+ if (Config.EXTENDED_SM_LOGGING) {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": requesting ack for message stanza #" + stanzasSent);
+ }
+ tagWriter.writeStanzaAsync(new RequestPacket(this.smVersion));
}
- tagWriter.writeStanzaAsync(new RequestPacket(this.smVersion));
}
}
}