This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new d5a6660 Close WebConnection d5a6660 is described below commit d5a6660cba7f51589468937bf3bbad4db7810371 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 1d29a7d..ef39f74 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 0bfea6d..8af1114 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -198,6 +198,14 @@ </add> </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> <update> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org