Author: markt
Date: Mon Apr 13 13:50:52 2015
New Revision: 1673188

URL: http://svn.apache.org/r1673188
Log:
Restore the creation of the network buffers to the construction.

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

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=1673188&r1=1673187&r2=1673188&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Mon Apr 
13 13:50:52 2015
@@ -67,6 +67,16 @@ public class SecureNioChannel extends Ni
             NioSelectorPool pool, NioEndpoint endpoint) {
         super(channel, bufHandler);
 
+        // Create the network buffers (these hold the encrypted data).
+        if (endpoint.getSocketProperties().getDirectSslBuffer()) {
+            netInBuffer = ByteBuffer.allocateDirect(DEFAULT_NET_BUFFER_SIZE);
+            netOutBuffer = ByteBuffer.allocateDirect(DEFAULT_NET_BUFFER_SIZE);
+        } else {
+            netInBuffer = ByteBuffer.allocate(DEFAULT_NET_BUFFER_SIZE);
+            netOutBuffer = ByteBuffer.allocateDirect(DEFAULT_NET_BUFFER_SIZE);
+        }
+
+
         // selector pool for blocking operations
         this.pool = pool;
         this.endpoint = endpoint;
@@ -221,20 +231,7 @@ public class SecureNioChannel extends Ni
      * provided host name, configure the SSLEngine for this connection.
      */
     private int processSNI() throws IOException {
-        SocketProperties sp = endpoint.getSocketProperties();
-
-        // Create the network input buffer as data needs to be read into this
-        // to be able to peek at it.
-        if (netInBuffer == null) {
-            if (sp.getDirectSslBuffer()) {
-                netInBuffer = 
ByteBuffer.allocateDirect(DEFAULT_NET_BUFFER_SIZE);
-                netOutBuffer = 
ByteBuffer.allocateDirect(DEFAULT_NET_BUFFER_SIZE);
-            } else {
-                netInBuffer = ByteBuffer.allocate(DEFAULT_NET_BUFFER_SIZE);
-                netOutBuffer = 
ByteBuffer.allocateDirect(DEFAULT_NET_BUFFER_SIZE);
-            }
-        }
-
+        // Read some data into the network input buffer so we can peek at it.
         sc.read(netInBuffer);
         SNIExtractor extractor = new SNIExtractor(netInBuffer);
 



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

Reply via email to