GUACAMOLE-2181: Silence noisy WebSocket error when socket is closed.

If the WebSocket is closed while a message is on its way out, an
IllegalStateException is thrown.
This commit is contained in:
Michael Jumper committed 2025-12-12 10:42:29 -08:00
1 parent 1457b186ff
commit b5748a1219
1 file changed
+7 -2
@@ -149,7 +149,12 @@ public abstract class GuacamoleWebSocketTunnelEndpoint extends Endpoint {
// connection has changed, and synchronization need only be performed
// in context of the new remote.
synchronized (remote) {
remote.sendText(instruction);
try {
remote.sendText(instruction);
}
catch (IllegalStateException e) {
throw new IOException("WebSocket message could not be sent.", e);
}
}
}
@@ -280,7 +285,7 @@ public abstract class GuacamoleWebSocketTunnelEndpoint extends Endpoint {
}
catch (IOException e) {
logger.debug("I/O error prevents further reads.", e);
logger.debug("I/O error prevents further WebSocket communication.", e);
closeConnection(session, GuacamoleStatus.SERVER_ERROR);
}