diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2012-03-19 20:20:24 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2012-03-19 20:20:24 +0000 |
commit | 84c9467b8e8a8e9cf2bb24944fec4bb91d4caeb8 (patch) | |
tree | 981f5e16b2ac04a4eac25f18dd6f5cfe6d82d242 | |
parent | 35022e07a90807f5f0686c146e49f469d4b3f2fd (diff) | |
download | tigervnc-84c9467b8e8a8e9cf2bb24944fec4bb91d4caeb8.tar.gz tigervnc-84c9467b8e8a8e9cf2bb24944fec4bb91d4caeb8.zip |
Fixes handshake failure caused by premature loop break when data is not ready.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4872 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | java/com/tigervnc/rfb/CConnection.java | 5 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/ConnParams.java | 11 |
2 files changed, 8 insertions, 8 deletions
diff --git a/java/com/tigervnc/rfb/CConnection.java b/java/com/tigervnc/rfb/CConnection.java index 1e55f043..e5392a1d 100644 --- a/java/com/tigervnc/rfb/CConnection.java +++ b/java/com/tigervnc/rfb/CConnection.java @@ -74,12 +74,11 @@ abstract public class CConnection extends CMsgHandler { private void processVersionMsg() { vlog.debug("reading protocol version"); - Boolean done = new Boolean(true); - if (!cp.readVersion(is, done)) { + if (!cp.readVersion(is)) { state_ = RFBSTATE_INVALID; throw new Exception("reading version failed: not an RFB server?"); } - if (!done.booleanValue()) return; + if (!cp.done) return; vlog.info("Server supports RFB protocol version " +cp.majorVersion+"."+ cp.minorVersion); diff --git a/java/com/tigervnc/rfb/ConnParams.java b/java/com/tigervnc/rfb/ConnParams.java index 08037231..3ea0496f 100644 --- a/java/com/tigervnc/rfb/ConnParams.java +++ b/java/com/tigervnc/rfb/ConnParams.java @@ -43,20 +43,20 @@ public class ConnParams { setName(""); } - public boolean readVersion(InStream is, Boolean done) + public boolean readVersion(InStream is) { + done = false; if (verStrPos >= 12) return false; verStr = new StringBuilder(13); - is.check(12); - while (verStrPos < 12) { + while (is.checkNoWait(1) && verStrPos < 12) { verStr.insert(verStrPos++,(char)is.readU8()); } if (verStrPos < 12) { - done = Boolean.valueOf(false); + done = false; return true; } - done = Boolean.valueOf(true); + done = true; verStr.insert(12,'0'); verStrPos = 0; if (verStr.toString().matches("RFB \\d{3}\\.\\d{3}\\n0")) { @@ -181,6 +181,7 @@ public class ConnParams { } } } + public boolean done; public boolean useCopyRect; public boolean supportsLocalCursor; |