diff options
author | Simon Rettberg | 2020-07-23 10:03:27 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-07-23 10:03:27 +0200 |
commit | 399598732e339fb1a91ecb328551e0f6f44303ad (patch) | |
tree | a7ddff6c1908c87fb931c152fd772e5f0b2579bf | |
parent | Add missing classes (diff) | |
download | bwlp-guacamole-ext-399598732e339fb1a91ecb328551e0f6f44303ad.tar.gz bwlp-guacamole-ext-399598732e339fb1a91ecb328551e0f6f44303ad.tar.xz bwlp-guacamole-ext-399598732e339fb1a91ecb328551e0f6f44303ad.zip |
Update client locationid in AvailableClient
-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) { |