diff options
-rw-r--r-- | src/com/isode/stroke/network/JavaConnection.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/isode/stroke/network/JavaConnection.java b/src/com/isode/stroke/network/JavaConnection.java index 3f768dc..807d971 100644 --- a/src/com/isode/stroke/network/JavaConnection.java +++ b/src/com/isode/stroke/network/JavaConnection.java @@ -177,13 +177,21 @@ public class JavaConnection extends Connection implements EventOwner { */ boolean finishedWriting = false; int bytesWritten = socketChannel_.write(byteBuffer); + final boolean somethingWasWritten = (bytesWritten != 0); + if (somethingWasWritten) { + eventLoop_.postEvent(new Callback() { + public void run() { + onDataWritten.emit(); + } + }); + } finishedWriting = (byteBuffer.remaining() == 0); if (finishedWriting) { writeBuffer_.remove(0); return; } /* Was anything written at all? */ - if (bytesWritten == 0) { + if (!somethingWasWritten) { /* Leave the buffer in the array so that it'll get tried * again later */ |