Close WebConnection · apache/tomcat@d5a6660 · 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 54411c2 commit d5a6660
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 @@ -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>
Expand Down

0 comments on commit d5a6660

Please sign in to comment.