You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2016/08/19 12:21:25 UTC
mina git commit: Applied patch provided by Maria Petridean (we don't
stop pushing data into the socket when we get an empty buffer,
which is a message end marker, in order to balance reads and writes)
Repository: mina
Updated Branches:
refs/heads/2.0 ce6d3e933 -> 12d45d143
Applied patch provided by Maria Petridean (we don't stop pushing data
into the socket when we get an empty buffer, which is a message end
marker, in order to balance reads and writes)
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/12d45d14
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/12d45d14
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/12d45d14
Branch: refs/heads/2.0
Commit: 12d45d14360003abae527896518483929742c497
Parents: ce6d3e9
Author: Emmanuel L�charny <el...@symas.com>
Authored: Fri Aug 19 14:21:12 2016 +0200
Committer: Emmanuel L�charny <el...@symas.com>
Committed: Fri Aug 19 14:21:12 2016 +0200
----------------------------------------------------------------------
.../polling/AbstractPollingIoProcessor.java | 32 +++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/12d45d14/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
index 2b649a4..5d23b35 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
@@ -814,6 +814,9 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im
+ (session.getConfig().getMaxReadBufferSize() >>> 1);
int writtenBytes = 0;
WriteRequest req = null;
+
+ // boolean to indicate if the current message is an empty buffer, representing a message marker
+ boolean isEmptyMessage = false;
try {
// Clear OP_WRITE
@@ -837,6 +840,7 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im
Object message = req.getMessage();
if (message instanceof IoBuffer) {
+ isEmptyMessage = !((IoBuffer) message).hasRemaining();
localWrittenBytes = writeBuffer(session, req, hasFragmentation, maxWrittenBytes - writtenBytes,
currentTime);
@@ -866,17 +870,23 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im
}
if (localWrittenBytes == 0) {
- // Kernel buffer is full.
- setInterestedInWrite(session, true);
- return false;
- }
-
- writtenBytes += localWrittenBytes;
-
- if (writtenBytes >= maxWrittenBytes) {
- // Wrote too much
- scheduleFlush(session);
- return false;
+ if (isEmptyMessage) {
+ // Kernel buffer is full.
+ setInterestedInWrite(session, true);
+ return false;
+ } else {
+ // Just processed a message marker - empty buffer;
+ // set the session write flag and continue
+ setInterestedInWrite(session, true);
+ }
+ } else {
+ writtenBytes += localWrittenBytes;
+
+ if (writtenBytes >= maxWrittenBytes) {
+ // Wrote too much
+ scheduleFlush(session);
+ return false;
+ }
}
if (message instanceof IoBuffer) {