mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
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
This commit is contained in:
parent
2eb13f48d2
commit
6dcf8e0123
1 changed files with 5 additions and 3 deletions
|
@ -193,12 +193,14 @@ class PacketWriter {
|
||||||
if (packet != null) {
|
if (packet != null) {
|
||||||
synchronized (writer) {
|
synchronized (writer) {
|
||||||
writer.write(packet.toXML());
|
writer.write(packet.toXML());
|
||||||
|
if (queue.isEmpty()) {
|
||||||
writer.flush();
|
writer.flush();
|
||||||
// Keep track of the last time a stanza was sent to the server
|
// Keep track of the last time a stanza was sent to the server
|
||||||
lastActive = System.currentTimeMillis();
|
lastActive = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Flush out the rest of the queue. If the queue is extremely large, it's possible
|
// Flush out the rest of the queue. If the queue is extremely large, it's possible
|
||||||
// we won't have time to entirely flush it before the socket is forced closed
|
// we won't have time to entirely flush it before the socket is forced closed
|
||||||
// by the shutdown process.
|
// by the shutdown process.
|
||||||
|
|
Loading…
Reference in a new issue