mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-567: Move client instability state to own flag. Actual current connection state is lost otherwise.
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
}]);
|
Reference in New Issue
Block a user