summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-20 17:00:18 +0200
committerSimon Rettberg2020-07-20 17:00:18 +0200
commit9b8e5fad625083d2d6531419f24ba95c3f7af615 (patch)
tree5a2d11a56d1c62ce43bde8b07c89fcc1376d3d97 /src
parentLog total numer of user sessions (no duplicates) (diff)
downloadbwlp-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
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/TunnelListener.java5
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);
}