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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 15891870f5 Avoid changing channel state on reset(null,null)
15891870f5 is described below

commit 15891870f53c82a88d08a520c045f99d5e1e6fa9
Author: remm <[email protected]>
AuthorDate: Mon Jan 26 10:38:27 2026 +0100

    Avoid changing channel state on reset(null,null)
    
    BZ69938
---
 java/org/apache/tomcat/util/net/SecureNio2Channel.java | 16 +++++++++-------
 java/org/apache/tomcat/util/net/SecureNioChannel.java  | 12 +++++++-----
 webapps/docs/changelog.xml                             |  8 ++++++++
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/SecureNio2Channel.java 
b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
index 9f4d38c601..e40d92f0d2 100644
--- a/java/org/apache/tomcat/util/net/SecureNio2Channel.java
+++ b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
@@ -137,13 +137,15 @@ public class SecureNio2Channel extends Nio2Channel {
     public void reset(AsynchronousSocketChannel channel, 
SocketWrapperBase<Nio2Channel> socket) throws IOException {
         super.reset(channel, socket);
         sslEngine = null;
-        sniComplete = false;
-        handshakeComplete = false;
-        handshakeWrapQueueLength.set(0);
-        unwrapBeforeRead = true;
-        closed = false;
-        closing = false;
-        netInBuffer.clear();
+        if (channel != null) {
+            sniComplete = false;
+            handshakeComplete = false;
+            handshakeWrapQueueLength.set(0);
+            unwrapBeforeRead = true;
+            closed = false;
+            closing = false;
+            netInBuffer.clear();
+        }
     }
 
     @Override
diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java 
b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index ff9178311c..c6b4193a89 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -95,11 +95,13 @@ public class SecureNioChannel extends NioChannel {
     public void reset(SocketChannel channel, NioSocketWrapper socketWrapper) 
throws IOException {
         super.reset(channel, socketWrapper);
         sslEngine = null;
-        sniComplete = false;
-        handshakeComplete = false;
-        closed = false;
-        closing = false;
-        netInBuffer.clear();
+        if (channel != null) {
+            sniComplete = false;
+            handshakeComplete = false;
+            closed = false;
+            closing = false;
+            netInBuffer.clear();
+        }
     }
 
     @Override
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f65c5d7061..9720e0c345 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.116 (remm)" rtext="in development">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        <bug>69938</bug>: Avoid changing the closed state of TLS channel when
+        resetting it after close. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <add>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to