From 0f64a36669caca4793af5a441925da6356b5a014 Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Tue, 25 Jun 2024 11:11:11 +0200 Subject: [PATCH] WebSockets Next: fix the default unhandled-failure-strategy - do not attempt to close a closed connection and get rid of superfluous WARN message --- .../java/io/quarkus/websockets/next/runtime/Endpoints.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/Endpoints.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/Endpoints.java index f3ca9d9247cd7..26bf46d6421a8 100644 --- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/Endpoints.java +++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/Endpoints.java @@ -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,