You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2017/06/07 00:32:25 UTC
[05/28] incubator-guacamole-client git commit: GUACAMOLE-102: Initial
stab at a WLC algorithm.
GUACAMOLE-102: Initial stab at a WLC algorithm.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/d0647ad6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/d0647ad6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/d0647ad6
Branch: refs/heads/master
Commit: d0647ad6a44d1a0785f29f40bd30412f8592e291
Parents: 4aff2c1
Author: Nick Couchman <vn...@apache.org>
Authored: Mon Mar 20 06:49:10 2017 -0400
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Mon Jun 5 15:34:21 2017 -0400
----------------------------------------------------------------------
.../tunnel/RestrictedGuacamoleTunnelService.java | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d0647ad6/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
index 9c01917..92cdfc6 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
@@ -191,9 +191,22 @@ public class RestrictedGuacamoleTunnelService
public int compare(ModeledConnection a, ModeledConnection b) {
logger.trace("Comparing {} to {}.", a.getName(), b.getName());
- return getActiveConnections(a).size()
- - getActiveConnections(b).size();
-
+ int cw = 0;
+
+ 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;
+
}
});