diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index ffbe3c539..41c6ba6b7 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -635,7 +635,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams * otherwise. */ $scope.isConnectionUnstable = function isConnectionUnstable() { - return $scope.client && $scope.client.clientState.connectionState === ManagedClientState.ConnectionState.UNSTABLE; + return $scope.client && $scope.client.clientState.tunnelUnstable; }; // Show status dialog when connection status changes diff --git a/guacamole/src/main/webapp/app/client/types/ManagedClient.js b/guacamole/src/main/webapp/app/client/types/ManagedClient.js index 09c96a91e..a9bc3beac 100644 --- a/guacamole/src/main/webapp/app/client/types/ManagedClient.js +++ b/guacamole/src/main/webapp/app/client/types/ManagedClient.js @@ -346,16 +346,14 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector', ManagedClientState.ConnectionState.CONNECTING); break; - // Connection is established + // Connection is established / no longer unstable case Guacamole.Tunnel.State.OPEN: - ManagedClientState.setConnectionState(managedClient.clientState, - ManagedClientState.ConnectionState.CONNECTED); + ManagedClientState.setTunnelUnstable(managedClient.clientState, false); break; // Connection is established but misbehaving case Guacamole.Tunnel.State.UNSTABLE: - ManagedClientState.setConnectionState(managedClient.clientState, - ManagedClientState.ConnectionState.UNSTABLE); + ManagedClientState.setTunnelUnstable(managedClient.clientState, true); break; // Connection has closed diff --git a/guacamole/src/main/webapp/app/client/types/ManagedClientState.js b/guacamole/src/main/webapp/app/client/types/ManagedClientState.js index 1a26b0dab..10f71b4d2 100644 --- a/guacamole/src/main/webapp/app/client/types/ManagedClientState.js +++ b/guacamole/src/main/webapp/app/client/types/ManagedClientState.js @@ -45,6 +45,16 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl */ this.connectionState = template.connectionState || ManagedClientState.ConnectionState.IDLE; + /** + * Whether the network connection used by the tunnel seems unstable. If + * the network connection is unstable, the remote desktop connection + * may perform poorly or disconnect. + * + * @type Boolean + * @default false + */ + this.tunnelUnstable = template.tunnelUnstable || false; + /** * The status code of the current error condition, if connectionState * is CLIENT_ERROR or TUNNEL_ERROR. For all other connectionState @@ -93,15 +103,6 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl */ CONNECTED : "CONNECTED", - /** - * The Guacamole connection has been successfully established, but the - * network connection seems unstable. The connection may perform poorly - * or disconnect. - * - * @type String - */ - UNSTABLE : "UNSTABLE", - /** * The Guacamole connection has terminated successfully. No errors are * indicated. @@ -130,7 +131,9 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl /** * Sets the current client state and, if given, the associated status code. - * If an error is already represented, this function has no effect. + * If an error is already represented, this function has no effect. If the + * client state was previously marked as unstable, that flag is implicitly + * cleared. * * @param {ManagedClientState} clientState * The ManagedClientState to update. @@ -153,6 +156,7 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl // Update connection state clientState.connectionState = connectionState; + clientState.tunnelUnstable = false; // Set status code, if given if (statusCode) @@ -160,6 +164,22 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl }; + /** + * Updates the given client state, setting whether the underlying tunnel + * is currently unstable. An unstable tunnel is not necessarily + * disconnected, but appears to be misbehaving and may be disconnected. + * + * @param {ManagedClientState} clientState + * The ManagedClientState to update. + * + * @param {Boolean} unstable + * Whether the underlying tunnel of the connection currently appears + * unstable. + */ + ManagedClientState.setTunnelUnstable = function setTunnelUnstable(clientState, unstable) { + clientState.tunnelUnstable = unstable; + }; + return ManagedClientState; }]); \ No newline at end of file