mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUAC-1096: Properly close() and cleanup HTTP tunnel when end-of-stream is encountered.
This commit is contained in:
@@ -305,8 +305,10 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
|||||||
} while (tunnel.isOpen() && (message = reader.read()) != null);
|
} while (tunnel.isOpen() && (message = reader.read()) != null);
|
||||||
|
|
||||||
// Close tunnel immediately upon EOF
|
// Close tunnel immediately upon EOF
|
||||||
if (message == null)
|
if (message == null) {
|
||||||
|
session.detachTunnel(tunnel);
|
||||||
tunnel.close();
|
tunnel.close();
|
||||||
|
}
|
||||||
|
|
||||||
// End-of-instructions marker
|
// End-of-instructions marker
|
||||||
out.write("0.;");
|
out.write("0.;");
|
||||||
@@ -314,11 +316,18 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
|||||||
response.flushBuffer();
|
response.flushBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send end-of-stream marker if connection is closed
|
// Send end-of-stream marker and close tunnel if connection is closed
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
|
|
||||||
|
// Detach and close
|
||||||
|
session.detachTunnel(tunnel);
|
||||||
|
tunnel.close();
|
||||||
|
|
||||||
|
// End-of-instructions marker
|
||||||
out.write("0.;");
|
out.write("0.;");
|
||||||
out.flush();
|
out.flush();
|
||||||
response.flushBuffer();
|
response.flushBuffer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
|
Reference in New Issue
Block a user