summaryrefslogtreecommitdiffstats
path: root/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java
diff options
context:
space:
mode:
authorUdo Walter2020-05-14 00:26:58 +0200
committerUdo Walter2020-05-14 00:26:58 +0200
commit22afa1455e509b09d60745e758bd7b2aecafe646 (patch)
tree01c696826f86a80f0a801322230cb01e8469f610 /src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java
parentAdd some debug logs. Rename the 'virtual' locations to groups. (diff)
downloadbwlp-guacamole-ext-22afa1455e509b09d60745e758bd7b2aecafe646.tar.gz
bwlp-guacamole-ext-22afa1455e509b09d60745e758bd7b2aecafe646.tar.xz
bwlp-guacamole-ext-22afa1455e509b09d60745e758bd7b2aecafe646.zip
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.
Diffstat (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java')
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java12
1 files changed, 11 insertions, 1 deletions
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;
}
}