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.
This commit is contained in:
Stephen Heumann 2015-09-25 19:02:52 -05:00
parent 50a273440a
commit 8cdef04732
3 changed files with 8 additions and 6 deletions

BIN
._README

Binary file not shown.

1
README
View File

@ -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

View File

@ -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;