diff options
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java index 30cd951..67df329 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java @@ -1,10 +1,11 @@ package de.bwlehrpool.bwlp_guac; -import java.io.*; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.Base64; import java.util.concurrent.atomic.AtomicLong; @@ -52,7 +53,6 @@ public class AvailableClient implements Cloneable { public AvailableClient(JsonClient source) { this.clientip = source.clientip; - this.locationid = source.locationid; update(source); } @@ -87,10 +87,12 @@ public class AvailableClient implements Cloneable { this.password = source.password; } + // Update state if different, but only change to idle if inUseBy is null if (this.inUseBy == null || source.state != State.IDLE) { this.state = source.state; } + this.locationid = source.locationid; this.deadline = 0; } @@ -140,8 +142,6 @@ public class AvailableClient implements Cloneable { deadline = NOW + 120000; // Was recently updated from remote, set 2min timeout return false; } - if (NOW < deadline) // Not timed out yet, no need to recheck - return false; long remaining = deadline - NOW; if (remaining < 120000) { synchronized (this) { |