Applied the patch proposed by Jon (DIRMINA-929) Project: http://git-wip-us.apache.org/repos/asf/mina/repo Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/f42feedc Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/f42feedc Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/f42feedc
Branch: refs/heads/2.0 Commit: f42feedcdaf8922df788fa5bde62e363cbc10c41 Parents: f72467a Author: Emmanuel Lécharny <[email protected]> Authored: Fri Jan 11 18:02:59 2013 +0100 Committer: Jeff MAURY <[email protected]> Committed: Wed Nov 27 13:23:03 2013 +0100 ---------------------------------------------------------------------- .../mina/core/polling/AbstractPollingIoProcessor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina/blob/f42feedc/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 0924f18..5268434 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 @@ -846,6 +846,7 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im if ((localWrittenBytes > 0) && ((IoBuffer) message).hasRemaining()) { // the buffer isn't empty, we re-interest it in writing + writtenBytes += localWrittenBytes; setInterestedInWrite(session, true); return false; } @@ -859,6 +860,7 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im // return 0 indicating that we need // to pause until writing may resume. if ((localWrittenBytes > 0) && (((FileRegion) message).getRemainingBytes() > 0)) { + writtenBytes += localWrittenBytes; setInterestedInWrite(session, true); return false; } @@ -880,6 +882,10 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im scheduleFlush(session); return false; } + + if (message instanceof IoBuffer) { + ((IoBuffer) message).free(); + } } while (writtenBytes < maxWrittenBytes); } catch (Exception e) { if (req != null) { @@ -913,7 +919,9 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im } catch (IOException ioe) { // We have had an issue while trying to send data to the // peer : let's close the session. + buf.free(); session.close(true); + return 0; } } @@ -925,8 +933,6 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im int pos = buf.position(); buf.reset(); - session.increaseScheduledWriteMessages(); - fireMessageSent(session, req); // And set it back to its position
