Skip to content

Commit

Permalink
WebSockets Next: fix the default unhandled-failure-strategy
Browse files Browse the repository at this point in the history
- do not attempt to close a closed connection and get rid of superfluous
WARN message
  • Loading branch information
mkouba committed Jun 25, 2024
1 parent 0484069 commit 0f64a36
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ private static void handleFailure(UnhandledFailureStrategy strategy, Throwable c
}

private static void closeConnection(Throwable cause, WebSocketConnectionBase connection) {
if (connection.isClosed()) {
return;
}
connection.close(CloseReason.INTERNAL_SERVER_ERROR).subscribe().with(
v -> LOG.debugf("Connection closed due to unhandled failure %s: %s", cause, connection),
t -> LOG.errorf("Unable to close connection [%s] due to unhandled failure [%s]: %s", connection.id(), cause,
Expand Down

0 comments on commit 0f64a36

Please sign in to comment.