mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-102: Tweak algorithm for computing the WLC vlaues.
This commit is contained in:
committed by
Nick Couchman
parent
d0647ad6a4
commit
83a8e8223e
@@ -416,19 +416,12 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
|
|||||||
* @return
|
* @return
|
||||||
* The weight of the connection.
|
* The weight of the connection.
|
||||||
*
|
*
|
||||||
* @throws GuacamoleException
|
|
||||||
* If an error occurs while parsing the concurrency limit properties
|
|
||||||
* specified within guacamole.properties.
|
|
||||||
*/
|
*/
|
||||||
public int getConnectionWeight() throws GuacamoleException {
|
public int getConnectionWeight() {
|
||||||
|
|
||||||
// Pull default from environment if weight is unset
|
// Return the connection weight
|
||||||
Integer value = getModel().getConnectionWeight();
|
return getModel().getConnectionWeight();
|
||||||
if (value == null)
|
|
||||||
return environment.getDefaultConnectionWeight();
|
|
||||||
|
|
||||||
// Otherwise use defined value
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -192,21 +192,13 @@ public class RestrictedGuacamoleTunnelService
|
|||||||
|
|
||||||
logger.trace("Comparing {} to {}.", a.getName(), b.getName());
|
logger.trace("Comparing {} to {}.", a.getName(), b.getName());
|
||||||
int cw = 0;
|
int cw = 0;
|
||||||
|
int weightA = a.getConnectionWeight();
|
||||||
|
int weightB = b.getConnectionWeight();
|
||||||
|
int connsA = getActiveConnections(a).size();
|
||||||
|
int connsB = getActiveConnections(b).size();
|
||||||
|
|
||||||
try {
|
return (connsA * 10000 / weightA) - (connsB * 10000 / weightB);
|
||||||
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