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()`.
This commit is contained in:
Or Cohen
2017-11-07 11:47:57 +02:00
parent d778ad7035
commit 63f603ec9d

View File

@@ -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");