diff options
author | Simon Rettberg | 2020-07-20 17:00:18 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-07-20 17:00:18 +0200 |
commit | 9b8e5fad625083d2d6531419f24ba95c3f7af615 (patch) | |
tree | 5a2d11a56d1c62ce43bde8b07c89fcc1376d3d97 | |
parent | Log total numer of user sessions (no duplicates) (diff) | |
download | bwlp-guacamole-ext-9b8e5fad625083d2d6531419f24ba95c3f7af615.tar.gz bwlp-guacamole-ext-9b8e5fad625083d2d6531419f24ba95c3f7af615.tar.xz bwlp-guacamole-ext-9b8e5fad625083d2d6531419f24ba95c3f7af615.zip |
Fix off-by-one when displaying tunnel count on close event
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java b/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java index 14f9c3a..5ed8927 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java @@ -46,8 +46,9 @@ public class TunnelListener implements Listener { synchronized (userTunnelCount) { count = userTunnelCount.get(username); if (count != null) { - if (count > 1) { - userTunnelCount.put(username, count - 1); + count -= 1; + if (count > 0) { + userTunnelCount.put(username, count); } else { userTunnelCount.remove(username); } |