THRIFT-5036 buffered transport over sockets may run into unexpected timeouts [ci skip]
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas
index 7695b22..0a9a39e 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -1628,7 +1628,7 @@
   result := 0;
   pTmp   := pBuf;
   Inc( pTmp, offset);
-  while count > 0 do begin
+  while (count > 0) and (result = 0) do begin
 
     while TRUE do begin
       wfd := WaitForData( msecs, pTmp, count, wsaError, nBytes);