You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/02/18 14:50:13 UTC
[tomcat] 04/06: s
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 87c3a96e7008b5707215ffe1d967c2ff0940184c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Feb 18 14:23:13 2022 +0000
s
---
java/org/apache/tomcat/util/net/NioChannel.java | 18 +++++++++---------
java/org/apache/tomcat/util/net/NioEndpoint.java | 5 +----
java/org/apache/tomcat/util/net/SecureNioChannel.java | 7 ++++---
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/NioChannel.java b/java/org/apache/tomcat/util/net/NioChannel.java
index d9bd848..4874d36 100644
--- a/java/org/apache/tomcat/util/net/NioChannel.java
+++ b/java/org/apache/tomcat/util/net/NioChannel.java
@@ -25,6 +25,7 @@ import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
+import org.apache.tomcat.util.net.NioEndpoint.NioSocketWrapper;
import org.apache.tomcat.util.net.NioEndpoint.Poller;
import org.apache.tomcat.util.res.StringManager;
@@ -46,17 +47,20 @@ public class NioChannel implements ByteChannel, ScatteringByteChannel, Gathering
protected Poller poller;
- public NioChannel(SocketChannel channel, SocketBufferHandler bufHandler) {
- this.sc = channel;
+ public NioChannel(SocketBufferHandler bufHandler) {
this.bufHandler = bufHandler;
}
/**
* Reset the channel
*
+ * @param channel the socket channel
+ * @param socketWrapper the socket wrapper
* @throws IOException If a problem was encountered resetting the channel
*/
- public void reset() throws IOException {
+ public void reset(SocketChannel channel, NioSocketWrapper socketWrapper) throws IOException {
+ this.sc = channel;
+ this.socketWrapper = socketWrapper;
bufHandler.reset();
}
@@ -221,10 +225,6 @@ public class NioChannel implements ByteChannel, ScatteringByteChannel, Gathering
this.poller = poller;
}
- public void setIOChannel(SocketChannel sc) {
- this.sc = sc;
- }
-
@Override
public String toString() {
return super.toString() + ":" + sc.toString();
@@ -273,7 +273,7 @@ public class NioChannel implements ByteChannel, ScatteringByteChannel, Gathering
static final NioChannel CLOSED_NIO_CHANNEL = new ClosedNioChannel();
public static class ClosedNioChannel extends NioChannel {
public ClosedNioChannel() {
- super(null, SocketBufferHandler.EMPTY);
+ super(SocketBufferHandler.EMPTY);
}
@Override
public void close() throws IOException {
@@ -283,7 +283,7 @@ public class NioChannel implements ByteChannel, ScatteringByteChannel, Gathering
return false;
}
@Override
- public void reset() throws IOException {
+ public void reset(SocketChannel channel, NioSocketWrapper socketWrapper) throws IOException {
}
@Override
public void free() {
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 286f33e..579ed4b 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -444,11 +444,8 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
if (isSSLEnabled()) {
channel = new SecureNioChannel(socket, bufhandler, selectorPool, this);
} else {
- channel = new NioChannel(socket, bufhandler);
+ channel = new NioChannel(bufhandler);
}
- } else {
- channel.setIOChannel(socket);
- channel.reset();
}
poller.register(channel);
return true;
diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index e2ae886..fb3924b8 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -39,6 +39,7 @@ import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.buf.ByteBufferUtils;
import org.apache.tomcat.util.compat.JreCompat;
+import org.apache.tomcat.util.net.NioEndpoint.NioSocketWrapper;
import org.apache.tomcat.util.net.TLSClientHelloExtractor.ExtractorResult;
import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
import org.apache.tomcat.util.res.StringManager;
@@ -76,7 +77,7 @@ public class SecureNioChannel extends NioChannel {
public SecureNioChannel(SocketChannel channel, SocketBufferHandler bufHandler,
NioSelectorPool pool, NioEndpoint endpoint) {
- super(channel, bufHandler);
+ super(bufHandler);
// Create the network buffers (these hold the encrypted data).
if (endpoint.getSocketProperties().getDirectSslBuffer()) {
@@ -93,8 +94,8 @@ public class SecureNioChannel extends NioChannel {
}
@Override
- public void reset() throws IOException {
- super.reset();
+ public void reset(SocketChannel channel, NioSocketWrapper socketWrapper) throws IOException {
+ super.reset(channel, socketWrapper);
sslEngine = null;
sniComplete = false;
handshakeComplete = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org