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 2011/01/10 17:25:08 UTC
svn commit: r1057260 -
/activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/SslTransport.java
Author: chirino
Date: Mon Jan 10 16:25:08 2011
New Revision: 1057260
URL: http://svn.apache.org/viewvc?rev=1057260&view=rev
Log:
Fixes tight spin loop that can occur.
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=1057260&r1=1057259&r2=1057260&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 Mon Jan 10 16:25:08 2011
@@ -186,15 +186,19 @@ public class SslTransport extends TcpTra
int rc=0;
while ( plain.hasRemaining() || engine.getHandshakeStatus() == NEED_UNWRAP ) {
if( readOverflowBuffer !=null ) {
- // lets drain the overflow buffer before trying to suck down anymore
- // network bytes.
- int size = Math.min(plain.remaining(), readOverflowBuffer.remaining());
- plain.put(readOverflowBuffer.array(), readOverflowBuffer.position(), size);
- readOverflowBuffer.position(readOverflowBuffer.position()+size);
- if( !readOverflowBuffer.hasRemaining() ) {
- readOverflowBuffer = null;
+ if( plain.hasRemaining() ) {
+ // lets drain the overflow buffer before trying to suck down anymore
+ // network bytes.
+ int size = Math.min(plain.remaining(), readOverflowBuffer.remaining());
+ plain.put(readOverflowBuffer.array(), readOverflowBuffer.position(), size);
+ readOverflowBuffer.position(readOverflowBuffer.position()+size);
+ if( !readOverflowBuffer.hasRemaining() ) {
+ readOverflowBuffer = null;
+ }
+ rc += size;
+ } else {
+ return rc;
}
- rc += size;
} else if( readUnderflow ) {
int count = channel.read(readBuffer);
if( count == -1 ) { // peer closed socket.