mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-102: Continue to work on the load balancing code.
This commit is contained in:
committed by
Nick Couchman
parent
15869fef0d
commit
d1259ef8df
@@ -175,8 +175,8 @@ public class ConnectionModel extends ChildObjectModel {
|
||||
* Sets the connection weight.
|
||||
*
|
||||
* @param connectionWeight
|
||||
* The weight of the connection. null is acceptable, -1 indicates the
|
||||
* connection should not be used.
|
||||
* The weight of the connection. null is acceptable, negative values
|
||||
* indicate that the connection should not be used.
|
||||
*/
|
||||
public void setConnectionWeight(Integer connectionWeight) {
|
||||
this.connectionWeight = connectionWeight;
|
||||
|
@@ -190,7 +190,11 @@ public class RestrictedGuacamoleTunnelService
|
||||
logger.debug("Calculating weights for connections {} and {}.", a.getName(), b.getName());
|
||||
int cw = 0;
|
||||
int weightA = a.getConnectionWeight();
|
||||
if (weightA == null)
|
||||
weightA = 0;
|
||||
int weightB = b.getConnectionWeight();
|
||||
if (weightB == null)
|
||||
weightB = 0;
|
||||
int connsA = getActiveConnections(a).size();
|
||||
int connsB = getActiveConnections(b).size();
|
||||
logger.debug("Connection {} has computed weight of {}.", a.getName(), connsA * 10000 / weightA);
|
||||
@@ -208,8 +212,8 @@ public class RestrictedGuacamoleTunnelService
|
||||
// Return the first unreserved connection
|
||||
for (ModeledConnection connection : sortedConnections) {
|
||||
|
||||
// If connection weight is negative, this host is disabled and should not be used.
|
||||
if (connection.getConnectionWeight() < 0)
|
||||
// If connection weight is zero or negative, this host is disabled and should not be used.
|
||||
if (connection.getConnectionWeight() < 1)
|
||||
continue;
|
||||
|
||||
// Attempt to aquire connection according to per-user limits
|
||||
|
Reference in New Issue
Block a user