diff options
Diffstat (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java')
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java | 11 |
1 files changed, 6 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 c60db10..5165a9c 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java @@ -161,11 +161,12 @@ public class AvailableClient implements Cloneable { if (now < this.lastConnectionCheck) { this.lastConnectionCheck = 0; } - if (now - this.lastConnectionCheck < 2000) + if (now - this.lastConnectionCheck < 750) return this.connectionOk; for (;;) { + String version = null; try (VncConnection vnc = new VncConnection(this.clientip, 5900)) { - String version = vnc.handshake(); + version = vnc.handshake(); if (version == null) { LOGGER.info("Host " + this.clientip + " doesn't speak RFB protocol"); break; @@ -173,11 +174,11 @@ public class AvailableClient implements Cloneable { LOGGER.debug("VNC Version for " + this.clientip + " is " + version); if (vnc.tryLogin(this.password)) { LOGGER.info("Connection to " + this + " is OK"); - this.lastConnectionCheck = now; + this.lastConnectionCheck = System.currentTimeMillis(); return this.connectionOk = true; } } catch (IOException e) { - LOGGER.info("Connection error VNC @ " + this); + LOGGER.info("Connection error VNC (" + version + ") @ " + this); if (retries-- > 0) { try { Thread.sleep(1000); @@ -190,7 +191,7 @@ public class AvailableClient implements Cloneable { } break; } - this.lastConnectionCheck = now; + this.lastConnectionCheck = System.currentTimeMillis(); this.password = null; // Render invalid, so ConnectionManager::getForUser() doesn't turn into an infinite loop return this.connectionOk = false; } |