From 399598732e339fb1a91ecb328551e0f6f44303ad Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 23 Jul 2020 10:03:27 +0200 Subject: Update client locationid in AvailableClient --- src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3-55-g7522