You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/12/14 23:51:56 UTC

svn commit: r1049317 - /activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java

Author: chirino
Date: Tue Dec 14 22:51:56 2010
New Revision: 1049317

URL: http://svn.apache.org/viewvc?rev=1049317&view=rev
Log:
Fixing bug in ssl transport.  Was not properly draining the overflow buffer.

Modified:
    activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java

Modified: activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java?rev=1049317&r1=1049316&r2=1049317&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java (original)
+++ activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java Tue Dec 14 22:51:56 2010
@@ -191,6 +191,7 @@ public class SslTransport extends TcpTra
                 // network bytes.
                 int size = Math.min(plain.remaining(), readOverflowBuffer.remaining());
                 plain.put(readOverflowBuffer.array(), 0, size);
+                readOverflowBuffer.position(readOverflowBuffer.position()+size);
                 if( !readOverflowBuffer.hasRemaining() ) {
                     readOverflowBuffer = null;
                 }
@@ -217,7 +218,11 @@ public class SslTransport extends TcpTra
                 if( result.getStatus() == BUFFER_OVERFLOW ) {
                     readOverflowBuffer = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize());
                     result = engine.unwrap(readBuffer, readOverflowBuffer);
-                    readOverflowBuffer.flip();
+                    if( readOverflowBuffer.position()==0 ) {
+                        readOverflowBuffer = null;
+                    } else {
+                        readOverflowBuffer.flip();
+                    }
                 }
                 switch( result.getStatus() ) {
                     case CLOSED: