From cb44042d3c576870d2ebc4ea94ec783a66b4824b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 18 Mar 2013 19:56:58 +0000 Subject: [PATCH] SMACK-419 PacketWriter: Only flush if queue is empty git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13565 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(); + } } } }