From 63f603ec9dfe91e33f4de83f27b6a81e1992c13a Mon Sep 17 00:00:00 2001 From: Or Cohen Date: Tue, 7 Nov 2017 11:47:57 +0200 Subject: [PATCH] GUACAMOLE-431: Fix tunnel stuck in CLOSED state When the tunnel is closed and another `connect()` call is made, it stops notifying about state changes (`onstatechanges`) if the connection continues to fail. This patch sets the state to `CONNECTING` when calling `connect()`. --- guacamole-common-js/src/main/webapp/modules/Tunnel.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/guacamole-common-js/src/main/webapp/modules/Tunnel.js b/guacamole-common-js/src/main/webapp/modules/Tunnel.js index 3fa6ef72a..2b1826dde 100644 --- a/guacamole-common-js/src/main/webapp/modules/Tunnel.js +++ b/guacamole-common-js/src/main/webapp/modules/Tunnel.js @@ -564,6 +564,9 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain) { // Start waiting for connect reset_timeout(); + // Mark the tunnel as connecting + tunnel.setState(Guacamole.Tunnel.State.CONNECTING); + // Start tunnel and connect var connect_xmlhttprequest = new XMLHttpRequest(); connect_xmlhttprequest.onreadystatechange = function() { @@ -760,6 +763,9 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { reset_timeout(); + // Mark the tunnel as connecting + tunnel.setState(Guacamole.Tunnel.State.CONNECTING); + // Connect socket socket = new WebSocket(tunnelURL + "?" + data, "guacamole");