summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2015-05-13 09:52:00 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2015-05-13 09:57:59 (GMT)
commit9c05025a8ef9c1dbfe2a9c8cc03fcad9d29a633e (patch)
treee5aa6127a8df28552b94f656ced6bdad60f802c9
parentc711267167ab73a72b1452025dcf87463b7fdeba (diff)
downloadstroke-9c05025a8ef9c1dbfe2a9c8cc03fcad9d29a633e.zip
stroke-9c05025a8ef9c1dbfe2a9c8cc03fcad9d29a633e.tar.bz2
Make sure Stroke clears write buffer before disconnecting
There was a bug with stroke where if I sent a large amount of messgaes (cica 1000) and then disconnected, not all the messages would be sent before storke handled the disconnect. It seems it did not fully lear the write buffer before closing the stream. This patch shoudl fix the error. It now only closses if the disconnecting flag is closed and the write buffer is closed. This should bring it into line with Swiften behaviour. Test-information: I had a simple stroke application that sent 1000 messages and then disconnected. Before the patch it would only send abut 80 or so of the messages before it got disconnected. After the patch it now sends all the messages before disconnecting. Change-Id: I6f56b25dcbabd16ee860dbf353f39559a77d6830 Signed-off-by: Alex Clayton <alex.clayton@isode.com>
-rw-r--r--src/com/isode/stroke/network/JavaConnection.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/isode/stroke/network/JavaConnection.java b/src/com/isode/stroke/network/JavaConnection.java
index 34f332b..3560e83 100644
--- a/src/com/isode/stroke/network/JavaConnection.java
+++ b/src/com/isode/stroke/network/JavaConnection.java
@@ -76,7 +76,7 @@ public class JavaConnection extends Connection implements EventOwner {
}
handleConnected(false);
- while (!disconnecting_) {
+ while (!disconnecting_ || isWriteNeeded()) {
/* Something(s) happened. See what needs doing */
boolean writeNeeded = isWriteNeeded();
boolean readNeeded = selectionKey_.isReadable();