GUAC-1096: Properly close() and cleanup HTTP tunnel when end-of-stream is encountered.

This commit is contained in:
Michael Jumper
2015-04-13 16:17:15 -07:00
parent 179466329e
commit 8d80854eec

View File

@@ -305,8 +305,10 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
} while (tunnel.isOpen() && (message = reader.read()) != null);
// Close tunnel immediately upon EOF
if (message == null)
if (message == null) {
session.detachTunnel(tunnel);
tunnel.close();
}
// End-of-instructions marker
out.write("0.;");
@@ -314,11 +316,18 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
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) {
// Detach and close
session.detachTunnel(tunnel);
tunnel.close();
// End-of-instructions marker
out.write("0.;");
out.flush();
response.flushBuffer();
}
catch (GuacamoleException e) {