tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From violet...@apache.org
Subject svn commit: r1760005 - in /tomcat/trunk/java/org/apache/tomcat/util/net: SecureNio2Channel.java SecureNioChannel.java
Date Fri, 09 Sep 2016 12:59:02 GMT
Author: violetagg
Date: Fri Sep  9 12:59:02 2016
New Revision: 1760005

URL: http://svn.apache.org/viewvc?rev=1760005&view=rev
Log:
Access the socket buffer handler via getBufHandler method for consistency with the rest of
the code.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
    tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1760005&r1=1760004&r2=1760005&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java Fri Sep  9 12:59:02
2016
@@ -378,7 +378,7 @@ public class SecureNio2Channel extends N
 
         // Ensure the application buffers (which have to be created earlier) are
         // big enough.
-        bufHandler.expand(sslEngine.getSession().getApplicationBufferSize());
+        getBufHandler().expand(sslEngine.getSession().getApplicationBufferSize());
         if (netOutBuffer.capacity() < sslEngine.getSession().getApplicationBufferSize())
{
             // Info for now as we may need to increase DEFAULT_NET_BUFFER_SIZE
             log.info(sm.getString("channel.nio.ssl.expandNetOutBuffer",
@@ -465,8 +465,8 @@ public class SecureNio2Channel extends N
         //so we can clear it here.
         netOutBuffer.clear();
         //perform the wrap
-        bufHandler.configureWriteBufferForRead();
-        SSLEngineResult result = sslEngine.wrap(bufHandler.getWriteBuffer(), netOutBuffer);
+        getBufHandler().configureWriteBufferForRead();
+        SSLEngineResult result = sslEngine.wrap(getBufHandler().getWriteBuffer(), netOutBuffer);
         //prepare the results to be written
         netOutBuffer.flip();
         //set the status
@@ -491,8 +491,8 @@ public class SecureNio2Channel extends N
             //prepare the buffer with the incoming data
             netInBuffer.flip();
             //call unwrap
-            bufHandler.configureReadBufferForWrite();
-            result = sslEngine.unwrap(netInBuffer, bufHandler.getReadBuffer());
+            getBufHandler().configureReadBufferForWrite();
+            result = sslEngine.unwrap(netInBuffer, getBufHandler().getReadBuffer());
             //compact the buffer, this is an optional method, wonder what would happen if
we didn't
             netInBuffer.compact();
             //read in the status
@@ -661,11 +661,11 @@ public class SecureNio2Channel extends N
                     } else {
                         // The SSL session has increased the required buffer size
                         // since the buffer was created.
-                        if (dst == socket.getSocketBufferHandler().getReadBuffer()) {
+                        if (dst == getBufHandler().getReadBuffer()) {
                             // This is the normal case for this code
-                            socket.getSocketBufferHandler().expand(
-                                    sslEngine.getSession().getApplicationBufferSize());
-                            dst = socket.getSocketBufferHandler().getReadBuffer();
+                            getBufHandler()
+                                    .expand(sslEngine.getSession().getApplicationBufferSize());
+                            dst = getBufHandler().getReadBuffer();
                         } else {
                             // Can't expand the buffer as there is no way to signal
                             // to the caller that the buffer has been replaced.
@@ -846,11 +846,11 @@ public class SecureNio2Channel extends N
                                 } else {
                                     // The SSL session has increased the required buffer
size
                                     // since the buffer was created.
-                                    if (dst2 == socket.getSocketBufferHandler().getReadBuffer())
{
+                                    if (dst2 == getBufHandler().getReadBuffer()) {
                                         // This is the normal case for this code
-                                        socket.getSocketBufferHandler().expand(
+                                        getBufHandler().expand(
                                                 sslEngine.getSession().getApplicationBufferSize());
-                                        dst2 = socket.getSocketBufferHandler().getReadBuffer();
+                                        dst2 = getBufHandler().getReadBuffer();
                                     } else {
                                         // Can't expand the buffer as there is no way to
signal
                                         // to the caller that the buffer has been replaced.

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1760005&r1=1760004&r2=1760005&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Fri Sep  9 12:59:02
2016
@@ -232,7 +232,7 @@ public class SecureNioChannel extends Ni
                         //read more data, reregister for OP_READ
                         return SelectionKey.OP_READ;
                     } else if (handshake.getStatus() == Status.BUFFER_OVERFLOW) {
-                        bufHandler.configureReadBufferForWrite();
+                        getBufHandler().configureReadBufferForWrite();
                     } else {
                         throw new IOException(sm.getString("channel.nio.ssl.unexpectedStatusDuringWrap",
handshakeStatus));
                     }//switch
@@ -307,7 +307,7 @@ public class SecureNioChannel extends Ni
 
         // Ensure the application buffers (which have to be created earlier) are
         // big enough.
-        bufHandler.expand(sslEngine.getSession().getApplicationBufferSize());
+        getBufHandler().expand(sslEngine.getSession().getApplicationBufferSize());
         if (netOutBuffer.capacity() < sslEngine.getSession().getApplicationBufferSize())
{
             // Info for now as we may need to increase DEFAULT_NET_BUFFER_SIZE
             log.info(sm.getString("channel.nio.ssl.expandNetOutBuffer",
@@ -410,8 +410,8 @@ public class SecureNioChannel extends Ni
         //so we can clear it here.
         netOutBuffer.clear();
         //perform the wrap
-        bufHandler.configureWriteBufferForWrite();
-        SSLEngineResult result = sslEngine.wrap(bufHandler.getWriteBuffer(), netOutBuffer);
+        getBufHandler().configureWriteBufferForWrite();
+        SSLEngineResult result = sslEngine.wrap(getBufHandler().getWriteBuffer(), netOutBuffer);
         //prepare the results to be written
         netOutBuffer.flip();
         //set the status
@@ -445,8 +445,8 @@ public class SecureNioChannel extends Ni
             //prepare the buffer with the incoming data
             netInBuffer.flip();
             //call unwrap
-            bufHandler.configureReadBufferForWrite();
-            result = sslEngine.unwrap(netInBuffer, bufHandler.getReadBuffer());
+            getBufHandler().configureReadBufferForWrite();
+            result = sslEngine.unwrap(netInBuffer, getBufHandler().getReadBuffer());
             //compact the buffer, this is an optional method, wonder what would happen if
we didn't
             netInBuffer.compact();
             //read in the status
@@ -523,12 +523,12 @@ public class SecureNioChannel extends Ni
      *         channel has reached end-of-stream
      * @throws IOException If some other I/O error occurs
      * @throws IllegalArgumentException if the destination buffer is different
-     *                                  than bufHandler.getReadBuffer()
+     *                                  than getBufHandler().getReadBuffer()
      */
     @Override
     public int read(ByteBuffer dst) throws IOException {
         // Make sure we only use the ApplicationBufferHandler's buffers
-        if (dst != bufHandler.getReadBuffer()) {
+        if (dst != getBufHandler().getReadBuffer()) {
             throw new IllegalArgumentException(sm.getString("channel.nio.ssl.invalidBuffer"));
         }
         //are we in the middle of closing or closed?
@@ -573,11 +573,10 @@ public class SecureNioChannel extends Ni
                 } else {
                     // The SSL session has increased the required buffer size
                     // since the buffer was created.
-                    if (dst == socketWrapper.getSocketBufferHandler().getReadBuffer()) {
+                    if (dst == getBufHandler().getReadBuffer()) {
                         // This is the normal case for this code
-                        socketWrapper.getSocketBufferHandler().expand(
-                                sslEngine.getSession().getApplicationBufferSize());
-                        dst = socketWrapper.getSocketBufferHandler().getReadBuffer();
+                        getBufHandler().expand(sslEngine.getSession().getApplicationBufferSize());
+                        dst = getBufHandler().getReadBuffer();
                     } else {
                         // Can't expand the buffer as there is no way to signal
                         // to the caller that the buffer has been replaced.
@@ -664,11 +663,6 @@ public class SecureNioChannel extends Ni
     }
 
     @Override
-    public SocketBufferHandler getBufHandler() {
-        return bufHandler;
-    }
-
-    @Override
     public boolean isHandshakeComplete() {
         return handshakeComplete;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message