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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new d27535b  Close WebConnection
d27535b is described below

commit d27535bdee95d252418201eb21e9d29476aa6b6a
Author: remm <r...@apache.org>
AuthorDate: Mon Sep 27 20:34:18 2021 +0200

    Close WebConnection
    
    The internal upgrade handler should close the associated WebConnection
    on destroy.
---
 java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java | 3 +++
 webapps/docs/changelog.xml                                        | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java 
b/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
index eebbdca..b49858c 100644
--- a/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
+++ b/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
@@ -100,6 +100,7 @@ public class WsHttpUpgradeHandler implements 
InternalHttpUpgradeHandler {
 
     @Override
     public void init(WebConnection connection) {
+        this.connection = connection;
         if (serverEndpointConfig == null) {
             throw new IllegalStateException(
                     sm.getString("wsHttpUpgradeHandler.noPreInit"));
@@ -212,7 +213,9 @@ public class WsHttpUpgradeHandler implements 
InternalHttpUpgradeHandler {
 
     @Override
     public void destroy() {
+        WebConnection connection = this.connection;
         if (connection != null) {
+            this.connection = null;
             try {
                 connection.close();
             } catch (Exception e) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2db1d2d..2c9deb3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -138,6 +138,14 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="WebSocket">
+    <changelog>
+      <fix>
+        The internal upgrade handler should close the associated
+        <code>WebConnection</code> on destroy. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>

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

Reply via email to