mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-102: Initial stab at a WLC algorithm.
This commit is contained in:
committed by
Nick Couchman
parent
4aff2c1bb8
commit
d0647ad6a4
@@ -191,9 +191,22 @@ public class RestrictedGuacamoleTunnelService
|
|||||||
public int compare(ModeledConnection a, ModeledConnection b) {
|
public int compare(ModeledConnection a, ModeledConnection b) {
|
||||||
|
|
||||||
logger.trace("Comparing {} to {}.", a.getName(), b.getName());
|
logger.trace("Comparing {} to {}.", a.getName(), b.getName());
|
||||||
return getActiveConnections(a).size()
|
int cw = 0;
|
||||||
- getActiveConnections(b).size();
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if(a.getConnectionWeight() > 0 && b.getConnectionWeight() > 0)
|
||||||
|
cw = (int)(a.getConnectionWeight()/getActiveConnections(a).size() - b.getConnectionWeight()/getActiveConnections(b).size());
|
||||||
|
else
|
||||||
|
cw = getActiveConnections(a).size() - getActiveConnections(b).size();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (GuacamoleException e) {
|
||||||
|
logger.error("Could not compare connections.", e.getMessage());
|
||||||
|
logger.debug("Could not compare connections.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cw;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user