From 17f6cc0d74177483ebfc59822d4d0f4ef9722860 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 20 Jul 2020 11:01:23 +0200 Subject: Log total numer of user sessions (no duplicates) --- src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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); } } -- cgit v1.2.3-55-g7522