From 22afa1455e509b09d60745e758bd7b2aecafe646 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Thu, 14 May 2020 00:26:58 +0200 Subject: Fix two ways a client could be listed as free but be not connectable. 1. User gets assigned a client but never connects to the vnc. Client is "in use" but ist actually idleing in the login screen. The client gets updated and the state set to IDLE but the inUseBy is not reset because the vnc password stays the same for some time. Clients in IDLE state with no user connected to the vnc tunnel now get reset to not in use. 2. If a client is missing from the JSON list and had IDLE as the last status it was still listed as IDLE until the timeout (5 minutes) where it is removed entirely. Missing clients waiting to timeout are now set to OFFLINE state. --- src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java') diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java b/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java index 3d46e73..a2ecb52 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java @@ -9,6 +9,8 @@ public class WrappedConnection extends SimpleConnection { private final AvailableClient ac; + private boolean valid = true; + public WrappedConnection(String name, AvailableClient ac) { super(name, name, makeConfig(ac)); this.ac = ac.clone(); @@ -20,7 +22,15 @@ public class WrappedConnection extends SimpleConnection { } public boolean checkConnection(int retries) { - return ac.checkConnection(retries); + return this.valid && ac.checkConnection(retries); + } + + public boolean isValid() { + return this.valid; + } + + public void invalidate() { + this.valid = false; } } -- cgit v1.2.3-55-g7522