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 2021/09/27 18:37:01 UTC

[tomcat] branch 9.0.x updated: Close WebConnection

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 80f1438  Close WebConnection
80f1438 is described below

commit 80f1438ec45e77a07b96419808971838d259eb47
Author: remm <re...@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 de2eb56..a8dc92f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -160,6 +160,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org