Updated Branches: refs/heads/trunk dbbdf9ea0 -> 31767ad4c
The readBuffer is now only cleared for not secured sessions Project: http://git-wip-us.apache.org/repos/asf/mina/repo Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/8bc3c404 Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/8bc3c404 Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/8bc3c404 Branch: refs/heads/trunk Commit: 8bc3c4047e2af669c6c8cbdc4d05ad8c63e914ef Parents: 2a1dbba Author: Emmanuel Lécharny <[email protected]> Authored: Fri May 3 16:05:24 2013 +0200 Committer: Emmanuel Lécharny <[email protected]> Committed: Fri May 3 16:05:24 2013 +0200 ---------------------------------------------------------------------- .../mina/transport/nio/tcp/NioTcpSession.java | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina/blob/8bc3c404/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpSession.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpSession.java b/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpSession.java index f06fda7..cd9e8d7 100644 --- a/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpSession.java +++ b/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpSession.java @@ -290,9 +290,6 @@ public class NioTcpSession extends AbstractIoSession implements SelectorListener try { LOG.debug("readable session : {}", this); - // First reset the buffer from what it contained before - readBuffer.clear(); - // Read everything we can up to the buffer size final int readCount = ((SocketChannel) channel).read(readBuffer); @@ -318,9 +315,14 @@ public class NioTcpSession extends AbstractIoSession implements SelectorListener } sslHelper.processRead(this, readBuffer); + + // We don't clear the buffer. It has been done by the sslHelper } else { // Plain message, not encrypted : go directly to the chain processMessageReceived(readBuffer); + + // And now, clear the buffer + readBuffer.clear(); } // Update the session idle status
