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.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
$scope.isConnectionUnstable = function isConnectionUnstable() {
|
$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
|
// Show status dialog when connection status changes
|
||||||
|
@@ -346,16 +346,14 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
ManagedClientState.ConnectionState.CONNECTING);
|
ManagedClientState.ConnectionState.CONNECTING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Connection is established
|
// Connection is established / no longer unstable
|
||||||
case Guacamole.Tunnel.State.OPEN:
|
case Guacamole.Tunnel.State.OPEN:
|
||||||
ManagedClientState.setConnectionState(managedClient.clientState,
|
ManagedClientState.setTunnelUnstable(managedClient.clientState, false);
|
||||||
ManagedClientState.ConnectionState.CONNECTED);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Connection is established but misbehaving
|
// Connection is established but misbehaving
|
||||||
case Guacamole.Tunnel.State.UNSTABLE:
|
case Guacamole.Tunnel.State.UNSTABLE:
|
||||||
ManagedClientState.setConnectionState(managedClient.clientState,
|
ManagedClientState.setTunnelUnstable(managedClient.clientState, true);
|
||||||
ManagedClientState.ConnectionState.UNSTABLE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Connection has closed
|
// Connection has closed
|
||||||
|
@@ -45,6 +45,16 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl
|
|||||||
*/
|
*/
|
||||||
this.connectionState = template.connectionState || ManagedClientState.ConnectionState.IDLE;
|
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
|
* The status code of the current error condition, if connectionState
|
||||||
* is CLIENT_ERROR or TUNNEL_ERROR. For all other connectionState
|
* is CLIENT_ERROR or TUNNEL_ERROR. For all other connectionState
|
||||||
@@ -93,15 +103,6 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl
|
|||||||
*/
|
*/
|
||||||
CONNECTED : "CONNECTED",
|
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
|
* The Guacamole connection has terminated successfully. No errors are
|
||||||
* indicated.
|
* indicated.
|
||||||
@@ -130,7 +131,9 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current client state and, if given, the associated status code.
|
* 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
|
* @param {ManagedClientState} clientState
|
||||||
* The ManagedClientState to update.
|
* The ManagedClientState to update.
|
||||||
@@ -153,6 +156,7 @@ angular.module('client').factory('ManagedClientState', [function defineManagedCl
|
|||||||
|
|
||||||
// Update connection state
|
// Update connection state
|
||||||
clientState.connectionState = connectionState;
|
clientState.connectionState = connectionState;
|
||||||
|
clientState.tunnelUnstable = false;
|
||||||
|
|
||||||
// Set status code, if given
|
// Set status code, if given
|
||||||
if (statusCode)
|
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;
|
return ManagedClientState;
|
||||||
|
|
||||||
}]);
|
}]);
|
Reference in New Issue
Block a user