mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUAC-906: Implement GuacamoleConnectionClosedException. Throw when read/write fails due to closure.
This commit is contained in:
		| @@ -32,6 +32,7 @@ import org.eclipse.jetty.websocket.WebSocket; | ||||
| import org.eclipse.jetty.websocket.WebSocket.Connection; | ||||
| import org.eclipse.jetty.websocket.WebSocketServlet; | ||||
| import org.glyptodon.guacamole.GuacamoleClientException; | ||||
| import org.glyptodon.guacamole.GuacamoleConnectionClosedException; | ||||
| import org.glyptodon.guacamole.protocol.GuacamoleStatus; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| @@ -93,6 +94,9 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet { | ||||
|                 try { | ||||
|                     writer.write(string.toCharArray()); | ||||
|                 } | ||||
|                 catch (GuacamoleConnectionClosedException e) { | ||||
|                     logger.debug("Connection closed.", e); | ||||
|                 } | ||||
|                 catch (GuacamoleException e) { | ||||
|                     logger.debug("Tunnel write failed.", e); | ||||
|                 } | ||||
| @@ -148,6 +152,10 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet { | ||||
|                                 logger.warn("Client request rejected: {}", e.getMessage()); | ||||
|                                 closeConnection(connection, e.getStatus()); | ||||
|                             } | ||||
|                             catch (GuacamoleConnectionClosedException e) { | ||||
|                                 logger.debug("Connection closed.", e); | ||||
|                                 closeConnection(connection, GuacamoleStatus.SUCCESS); | ||||
|                             } | ||||
|                             catch (GuacamoleException e) { | ||||
|                                 logger.error("Internal server error.", e); | ||||
|                                 closeConnection(connection, e.getStatus()); | ||||
|   | ||||
| @@ -28,6 +28,7 @@ import org.eclipse.jetty.websocket.api.RemoteEndpoint; | ||||
| import org.eclipse.jetty.websocket.api.Session; | ||||
| import org.eclipse.jetty.websocket.api.WebSocketListener; | ||||
| import org.glyptodon.guacamole.GuacamoleClientException; | ||||
| import org.glyptodon.guacamole.GuacamoleConnectionClosedException; | ||||
| import org.glyptodon.guacamole.GuacamoleException; | ||||
| import org.glyptodon.guacamole.io.GuacamoleReader; | ||||
| import org.glyptodon.guacamole.io.GuacamoleWriter; | ||||
| @@ -164,6 +165,10 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe | ||||
|                         logger.warn("Client request rejected: {}", e.getMessage()); | ||||
|                         closeConnection(session, e.getStatus()); | ||||
|                     } | ||||
|                     catch (GuacamoleConnectionClosedException e) { | ||||
|                         logger.debug("Connection closed.", e); | ||||
|                         closeConnection(session, GuacamoleStatus.SUCCESS); | ||||
|                     } | ||||
|                     catch (GuacamoleException e) { | ||||
|                         logger.error("Internal server error.", e); | ||||
|                         closeConnection(session, e.getStatus()); | ||||
| @@ -191,6 +196,9 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe | ||||
|             // Write received message | ||||
|             writer.write(message.toCharArray()); | ||||
|         } | ||||
|         catch (GuacamoleConnectionClosedException e) { | ||||
|             logger.debug("Connection closed.", e); | ||||
|         } | ||||
|         catch (GuacamoleException e) { | ||||
|             logger.debug("Tunnel write failed.", e); | ||||
|         } | ||||
|   | ||||
| @@ -37,6 +37,7 @@ import org.apache.catalina.websocket.StreamInbound; | ||||
| import org.apache.catalina.websocket.WebSocketServlet; | ||||
| import org.apache.catalina.websocket.WsOutbound; | ||||
| import org.glyptodon.guacamole.GuacamoleClientException; | ||||
| import org.glyptodon.guacamole.GuacamoleConnectionClosedException; | ||||
| import org.glyptodon.guacamole.protocol.GuacamoleStatus; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| @@ -120,6 +121,9 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet { | ||||
|                         writer.write(buffer, 0, num_read); | ||||
|  | ||||
|                 } | ||||
|                 catch (GuacamoleConnectionClosedException e) { | ||||
|                     logger.debug("Connection closed.", e); | ||||
|                 } | ||||
|                 catch (GuacamoleException e) { | ||||
|                     logger.debug("Tunnel write failed.", e); | ||||
|                 } | ||||
| @@ -180,6 +184,10 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet { | ||||
|                                 logger.warn("Client request rejected: {}", e.getMessage()); | ||||
|                                 closeConnection(outbound, e.getStatus()); | ||||
|                             } | ||||
|                             catch (GuacamoleConnectionClosedException e) { | ||||
|                                 logger.debug("Connection closed.", e); | ||||
|                                 closeConnection(outbound, GuacamoleStatus.SUCCESS); | ||||
|                             } | ||||
|                             catch (GuacamoleException e) { | ||||
|                                 logger.error("Internal server error.", e); | ||||
|                                 closeConnection(outbound, e.getStatus()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user