From 8cdef04732564cfab4a6f69889781e9ab21e3c41 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Fri, 25 Sep 2015 19:02:52 -0500 Subject: [PATCH] Terminate blocking reads on TCP errors, instead of waiting for timer to expire. This should avoid most cases where the program seems to hang for 15 seconds. --- ._README | Bin 1334 -> 1334 bytes README | 1 + vncsession.cc | 13 +++++++------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/._README b/._README index da9fea97900f46d1ac3a02eeb2206b105ea9f79f..226f9845902492f3a84cf42c9e932402ba3ed700 100644 GIT binary patch delta 69 zcmdnSwT)}SJwcwS4;YvkdKefO>=+psN*K5&zAqNvF#7?6Py>+9a0)~)@G&zm+?f4f XawFs1i3J>+<(SqmF}|C8nk5?mwKf#J delta 69 zcmdnSwT)}SJ;9EN4;YvkdKefO>=+psN*FjMzAqNHSnz;Br~$}lI0YgY_?Q_OLKZ!k X+{ie0VgbiyIi@vCjEg3pX2}Ksvy2n= diff --git a/README b/README index 70deb66..e9bd429 100644 --- a/README +++ b/README @@ -62,6 +62,7 @@ Version History 1.0b2 First open source release Can display the mouse cursor from the server locally on the IIgs +Detects some errors more quickly, avoiding long periods of unresponsiveness Mapping of OA and Option keys reversed to match Mac VNC implementations 1.0b1 diff --git a/vncsession.cc b/vncsession.cc index 428ee9d..5ae1847 100644 --- a/vncsession.cc +++ b/vncsession.cc @@ -283,6 +283,7 @@ BOOLEAN GetIpid (void) #undef baseDisplayNum } +unsigned int tcperr; /* Read data, waiting for up to 15 seconds for the data to be ready */ BOOLEAN DoWaitingReadTCP(unsigned long dataLength) { @@ -292,7 +293,7 @@ BOOLEAN DoWaitingReadTCP(unsigned long dataLength) { stopTime = TickCount() + 15 * 60; do { result = DoReadTCP(dataLength); - } while (result == FALSE && TickCount() < stopTime); + } while (result == FALSE && tcperr == tcperrOK && TickCount() < stopTime); return result; } @@ -308,8 +309,8 @@ BOOLEAN ReadFixup (unsigned long requested, unsigned long returned) { do { TCPIPPoll(); - if (TCPIPReadTCP(hostIpid, buffTypeNewHandle, NULL, - requested-returned, &theRRBuff) != tcperrOK) + if ((tcperr = TCPIPReadTCP(hostIpid, buffTypeNewHandle, NULL, + requested-returned, &theRRBuff)) != tcperrOK) return FALSE; if (toolerror()) return FALSE; @@ -337,7 +338,7 @@ BOOLEAN DoReadTCP (unsigned long dataLength) { TCPIPPoll(); - if (TCPIPStatusTCP(hostIpid, &theSRBuff) != tcperrOK) + if ((tcperr = TCPIPStatusTCP(hostIpid, &theSRBuff)) != tcperrOK) return FALSE; if (toolerror()) return FALSE; @@ -345,8 +346,8 @@ BOOLEAN DoReadTCP (unsigned long dataLength) { if (theSRBuff.srRcvQueued < dataLength) return FALSE; - if (TCPIPReadTCP(hostIpid, buffTypeHandle, (Ref) readBufferHndl, - dataLength, &theRRBuff) != tcperrOK) + if ((tcperr = TCPIPReadTCP(hostIpid, buffTypeHandle, (Ref) readBufferHndl, + dataLength, &theRRBuff)) != tcperrOK) return FALSE; if (toolerror()) return FALSE;