activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1332230 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
Date Mon, 30 Apr 2012 14:56:10 GMT
Author: dejanb
Date: Mon Apr 30 14:56:09 2012
New Revision: 1332230

URL: http://svn.apache.org/viewvc?rev=1332230&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3819 - handle BUFFER_UNDERFLOW case

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java?rev=1332230&r1=1332229&r2=1332230&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
Mon Apr 30 14:56:09 2012
@@ -135,7 +135,11 @@ public class NIOSSLTransport extends NIO
             while(true) {
                 if (!plain.hasRemaining()) {
 
-                    plain.clear();
+                    if (status == SSLEngineResult.Status.OK && handshakeStatus !=
SSLEngineResult.HandshakeStatus.NEED_UNWRAP) {
+                        plain.clear();
+                    } else {
+                        plain.compact();
+                    }
                     int readCount = secureRead(plain);
 
 
@@ -150,7 +154,9 @@ public class NIOSSLTransport extends NIO
                     }
                 }
 
-                processCommand(plain);
+                if (status == SSLEngineResult.Status.OK && handshakeStatus != SSLEngineResult.HandshakeStatus.NEED_UNWRAP)
{
+                    processCommand(plain);
+                }
 
             }
         } catch (IOException e) {
@@ -192,7 +198,7 @@ public class NIOSSLTransport extends NIO
 
     protected int secureRead(ByteBuffer plain) throws Exception {
 
-        if (!(inputBuffer.position() != 0 && inputBuffer.hasRemaining())) {
+        if (!(inputBuffer.position() != 0 && inputBuffer.hasRemaining()) || status
== SSLEngineResult.Status.BUFFER_UNDERFLOW) {
             int bytesRead = channel.read(inputBuffer);
 
             if (bytesRead == -1) {



Mime
View raw message