summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-20 11:01:23 +0200
committerSimon Rettberg2020-07-20 11:01:23 +0200
commit17f6cc0d74177483ebfc59822d4d0f4ef9722860 (patch)
tree719424094376f6e3ba98c89496bb7d33a9c3cec8
parentFix getUsername/getIdentifier in TunnelListener, make it thread safe (diff)
downloadbwlp-guacamole-ext-17f6cc0d74177483ebfc59822d4d0f4ef9722860.tar.gz
bwlp-guacamole-ext-17f6cc0d74177483ebfc59822d4d0f4ef9722860.tar.xz
bwlp-guacamole-ext-17f6cc0d74177483ebfc59822d4d0f4ef9722860.zip
Log total numer of user sessions (no duplicates)
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java b/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java
index ed3aaa3..14f9c3a 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java
@@ -23,10 +23,11 @@ public class TunnelListener implements Listener {
return userTunnelCount.get(username) != null;
}
}
-
+
@Override
public void handleEvent(Object event) throws GuacamoleException {
Integer count;
+ int total;
if (event instanceof TunnelConnectEvent) {
String username = Util.getUsername((TunnelConnectEvent)event);
synchronized (userTunnelCount) {
@@ -37,8 +38,9 @@ public class TunnelListener implements Listener {
count++;
}
userTunnelCount.put(username, count);
+ total = userTunnelCount.size();
}
- LOGGER.info("User " + username + " connected to a tunnel, count: " + count);
+ LOGGER.info("User " + username + " connected to a tunnel, count: " + count + ", total: " + total);
} else if (event instanceof TunnelCloseEvent) {
String username = Util.getUsername((TunnelCloseEvent)event);
synchronized (userTunnelCount) {
@@ -52,8 +54,9 @@ public class TunnelListener implements Listener {
} else {
count = 0;
}
+ total = userTunnelCount.size();
}
- LOGGER.info("User " + username + " closed a tunnel, count: " + count);
+ LOGGER.info("User " + username + " closed a tunnel, count: " + count + ", total: " + total);
}
}