You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/10/02 16:10:28 UTC

[tomcat] branch master updated: Harmonize names with NIO

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new e68e417  Harmonize names with NIO
e68e417 is described below

commit e68e41700fd7235bc29f47c40624ee2da5c90698
Author: remm <re...@apache.org>
AuthorDate: Wed Oct 2 18:10:19 2019 +0200

    Harmonize names with NIO
---
 java/org/apache/tomcat/util/net/Nio2Channel.java       | 14 +++++++-------
 java/org/apache/tomcat/util/net/Nio2Endpoint.java      |  2 +-
 java/org/apache/tomcat/util/net/SecureNio2Channel.java | 16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Channel.java b/java/org/apache/tomcat/util/net/Nio2Channel.java
index 90986a5..4980170 100644
--- a/java/org/apache/tomcat/util/net/Nio2Channel.java
+++ b/java/org/apache/tomcat/util/net/Nio2Channel.java
@@ -36,9 +36,9 @@ public class Nio2Channel implements AsynchronousByteChannel {
 
     protected static final ByteBuffer emptyBuf = ByteBuffer.allocate(0);
 
-    protected AsynchronousSocketChannel sc = null;
-    protected SocketWrapperBase<Nio2Channel> socket = null;
     protected final SocketBufferHandler bufHandler;
+    protected AsynchronousSocketChannel sc = null;
+    protected SocketWrapperBase<Nio2Channel> socketWrapper = null;
 
     public Nio2Channel(SocketBufferHandler bufHandler) {
         this.bufHandler = bufHandler;
@@ -48,14 +48,14 @@ public class Nio2Channel implements AsynchronousByteChannel {
      * Reset the channel.
      *
      * @param channel The new async channel to associate with this NIO2 channel
-     * @param socket  The new socket to associate with this NIO2 channel
+     * @param socketWrapper The new socket to associate with this NIO2 channel
      *
      * @throws IOException If a problem was encountered resetting the channel
      */
-    public void reset(AsynchronousSocketChannel channel, SocketWrapperBase<Nio2Channel> socket)
+    public void reset(AsynchronousSocketChannel channel, SocketWrapperBase<Nio2Channel> socketWrapper)
             throws IOException {
         this.sc = channel;
-        this.socket = socket;
+        this.socketWrapper = socketWrapper;
         bufHandler.reset();
     }
 
@@ -66,8 +66,8 @@ public class Nio2Channel implements AsynchronousByteChannel {
         bufHandler.free();
     }
 
-    public SocketWrapperBase<Nio2Channel> getSocket() {
-        return socket;
+    SocketWrapperBase<Nio2Channel> getSocketWrapper() {
+        return socketWrapper;
     }
 
 
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 88c17cc..0ff7c4f 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -213,7 +213,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                     // Then close all active connections if any remain
                     try {
                         for (Nio2Channel channel : getHandler().getOpenSockets()) {
-                            channel.getSocket().close();
+                            channel.getSocketWrapper().close();
                         }
                     } catch (Throwable t) {
                         ExceptionUtils.handleThrowable(t);
diff --git a/java/org/apache/tomcat/util/net/SecureNio2Channel.java b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
index 740f12b..54d9e03 100644
--- a/java/org/apache/tomcat/util/net/SecureNio2Channel.java
+++ b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
@@ -243,10 +243,10 @@ public class SecureNio2Channel extends Nio2Channel  {
                 case FINISHED: {
                     if (endpoint.hasNegotiableProtocols()) {
                         if (sslEngine instanceof SSLUtil.ProtocolInfo) {
-                            socket.setNegotiatedProtocol(
+                            socketWrapper.setNegotiatedProtocol(
                                     ((SSLUtil.ProtocolInfo) sslEngine).getNegotiatedProtocol());
                         } else if (JreCompat.isJre9Available()) {
-                            socket.setNegotiatedProtocol(
+                            socketWrapper.setNegotiatedProtocol(
                                     JreCompat.getInstance().getApplicationProtocol(sslEngine));
                         }
                     }
@@ -258,7 +258,7 @@ public class SecureNio2Channel extends Nio2Channel  {
                     } else {
                         if (async) {
                             sc.write(netOutBuffer, AbstractEndpoint.toTimeout(timeout),
-                                    TimeUnit.MILLISECONDS, socket, handshakeWriteCompletionHandler);
+                                    TimeUnit.MILLISECONDS, socketWrapper, handshakeWriteCompletionHandler);
                         } else {
                             try {
                                 if (timeout > 0) {
@@ -296,7 +296,7 @@ public class SecureNio2Channel extends Nio2Channel  {
                         //should actually return OP_READ if we have NEED_UNWRAP
                         if (async) {
                             sc.write(netOutBuffer, AbstractEndpoint.toTimeout(timeout),
-                                    TimeUnit.MILLISECONDS, socket, handshakeWriteCompletionHandler);
+                                    TimeUnit.MILLISECONDS, socketWrapper, handshakeWriteCompletionHandler);
                         } else {
                             try {
                                 if (timeout > 0) {
@@ -328,7 +328,7 @@ public class SecureNio2Channel extends Nio2Channel  {
                         //read more data
                         if (async) {
                             sc.read(netInBuffer, AbstractEndpoint.toTimeout(timeout),
-                                    TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
+                                    TimeUnit.MILLISECONDS, socketWrapper, handshakeReadCompletionHandler);
                         } else {
                             try {
                                 int read;
@@ -373,7 +373,7 @@ public class SecureNio2Channel extends Nio2Channel  {
         // SNIExtractor only to discover there is no data to process
         if (netInBuffer.position() == 0) {
             sc.read(netInBuffer, AbstractEndpoint.toTimeout(endpoint.getConnectionTimeout()),
-                    TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
+                    TimeUnit.MILLISECONDS, socketWrapper, handshakeReadCompletionHandler);
             return 1;
         }
 
@@ -389,7 +389,7 @@ public class SecureNio2Channel extends Nio2Channel  {
 
             netInBuffer = ByteBufferUtils.expand(netInBuffer, newLimit);
             sc.read(netInBuffer, AbstractEndpoint.toTimeout(endpoint.getConnectionTimeout()),
-                    TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
+                    TimeUnit.MILLISECONDS, socketWrapper, handshakeReadCompletionHandler);
             return 1;
         }
 
@@ -407,7 +407,7 @@ public class SecureNio2Channel extends Nio2Channel  {
             break;
         case NEED_READ:
             sc.read(netInBuffer, AbstractEndpoint.toTimeout(endpoint.getConnectionTimeout()),
-                    TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
+                    TimeUnit.MILLISECONDS, socketWrapper, handshakeReadCompletionHandler);
             return 1;
         case UNDERFLOW:
             // Unable to buffer enough data to read SNI extension data


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