diff options
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java b/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java index d1ac1ad..5b252df 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/VncConnection.java @@ -54,8 +54,7 @@ public class VncConnection implements Closeable { boolean ok = false; for (int i = 0; i < numTypes; ++i) { if (in.read() == 2) { - ok = true; - break; // Found "VNC Authentication" + ok = true; // Found "VNC Authentication" } } if (!ok) { @@ -65,8 +64,9 @@ public class VncConnection implements Closeable { out.write(2); // Pick passwd auth // Get challenge data byte[] challenge = new byte[16]; - int ret = in.read(challenge); - if (ret != 16) { + try { + in.readFully(challenge); + } catch (Exception e) { LOGGER.info("Didn't receive challenge from VNC server @ " + sock.getRemoteSocketAddress()); return false; } |