From 6dcf8e0123c3599f5ac43ab1c5014c3735c857c2 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 18 Mar 2013 19:58:14 +0000 Subject: [PATCH] SMACK-419 PacketWriter: Only flush if queue is empty git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13567 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/PacketWriter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/org/jivesoftware/smack/PacketWriter.java b/source/org/jivesoftware/smack/PacketWriter.java index 8213bbd35..155110cfb 100644 --- a/source/org/jivesoftware/smack/PacketWriter.java +++ b/source/org/jivesoftware/smack/PacketWriter.java @@ -193,9 +193,11 @@ class PacketWriter { if (packet != null) { synchronized (writer) { writer.write(packet.toXML()); - writer.flush(); - // Keep track of the last time a stanza was sent to the server - lastActive = System.currentTimeMillis(); + if (queue.isEmpty()) { + writer.flush(); + // Keep track of the last time a stanza was sent to the server + lastActive = System.currentTimeMillis(); + } } } }