Close WebConnection · apache/tomcat@80f1438 · GitHub
Skip to content

Commit

Permalink
Close WebConnection
Browse files Browse the repository at this point in the history
The internal upgrade handler should close the associated WebConnection
on destroy.
  • Loading branch information
rmaucher committed Sep 27, 2021
1 parent 0237b67 commit 80f1438
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void preInit(ServerEndpointConfig serverEndpointConfig,

@Override
public void init(WebConnection connection) {
this.connection = connection;
if (serverEndpointConfig == null) {
throw new IllegalStateException(
sm.getString("wsHttpUpgradeHandler.noPreInit"));
Expand Down Expand Up @@ -212,7 +213,9 @@ public void pause() {

@Override
public void destroy() {
WebConnection connection = this.connection;
if (connection != null) {
this.connection = null;
try {
connection.close();
} catch (Exception e) {
Expand Down
8 changes: 8 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 80f1438

Please sign in to comment.