GUACAMOLE-102: Remove unnecessary checks for weight value in the compare function.

This commit is contained in:
Nick Couchman
2017-06-02 14:51:27 -04:00
committed by Nick Couchman
parent 58637818ca
commit aa4c134922

View File

@@ -188,20 +188,9 @@ public class RestrictedGuacamoleTunnelService
@Override
public int compare(ModeledConnection a, ModeledConnection b) {
int weightA, weightB;
// Check if weight of a is non-null and retrieve it.
if (a.getConnectionWeight().intValue() > 0)
weightA = a.getConnectionWeight().intValue();
// In all other cases assign 1 for sorting.
else
weightA = 1;
// Check if weight of b is null, assign 1 if it is.
if (b.getConnectionWeight().intValue() > 0)
weightB = b.getConnectionWeight().intValue();
// In all other cases assign 1 for sorting.
else
weightB = 1;
// Get connection weight for the two systems being compared.
int weightA = a.getConnectionWeight().intValue();
int weightB = b.getConnectionWeight().intValue();
// Get current active connections, add 1 to both to avoid calculations with 0.
int connsA = getActiveConnections(a).size() + 1;