From 3a175f9b02d49ac969d44b6f96c4bdcace1e2ad0 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 28 May 2016 20:41:43 -0500 Subject: [PATCH] Have Marinetti return read data in a new handle. This should be faster than the other options (reusing an existing handle or using a pointer) because it avoids an extra copy of the data inside Marinetti. For the other options, Marinetti will create a new handle and copy the data to it anyway, but then copy it again into the requested destination. --- vncsession.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vncsession.cc b/vncsession.cc index 17cf969..1e27922 100644 --- a/vncsession.cc +++ b/vncsession.cc @@ -360,11 +360,13 @@ BOOLEAN DoReadTCP (unsigned long dataLength) { if (theSRBuff.srRcvQueued < dataLength) return FALSE; - if ((tcperr = TCPIPReadTCP(hostIpid, buffTypeHandle, (Ref) readBufferHndl, + DisposeHandle(readBufferHndl); + if ((tcperr = TCPIPReadTCP(hostIpid, buffTypeNewHandle, NULL, dataLength, &theRRBuff)) != tcperrOK) return FALSE; if (toolerror()) return FALSE; + readBufferHndl = theRRBuff.rrBuffHandle; if (theRRBuff.rrBuffCount != dataLength) return ReadFixup(dataLength, theRRBuff.rrBuffCount);