@@ -4157,10 +4157,8 @@ - (void)doReadData
4157
4157
return ;
4158
4158
}
4159
4159
4160
- BOOL done = NO ; // Completed read operation
4161
- BOOL waiting = NO ; // Ran out of data, waiting for more
4162
- BOOL socketEOF = (flags & kSocketHasReadEOF ) ? YES : NO ; // Nothing more to via socket (end of file)
4163
- NSError *error = nil ; // Error occured
4160
+ BOOL done = NO ; // Completed read operation
4161
+ NSError *error = nil ; // Error occured
4164
4162
4165
4163
NSUInteger totalBytesReadForCurrentRead = 0 ;
4166
4164
@@ -4257,7 +4255,10 @@ - (void)doReadData
4257
4255
// STEP 2 - READ FROM SOCKET
4258
4256
//
4259
4257
4260
- if (!done && !waiting && !socketEOF && !error && hasBytesAvailable)
4258
+ BOOL socketEOF = (flags & kSocketHasReadEOF ) ? YES : NO ; // Nothing more to via socket (end of file)
4259
+ BOOL waiting = !done && !error && !socketEOF && !hasBytesAvailable; // Ran out of data, waiting for more
4260
+
4261
+ if (!done && !error && !socketEOF && !waiting && hasBytesAvailable)
4261
4262
{
4262
4263
NSAssert ((partialReadBufferLength == 0 ), @"Invalid logic");
4263
4264
@@ -4600,7 +4601,7 @@ - (void)doReadData
4600
4601
4601
4602
} // if (bytesRead > 0)
4602
4603
4603
- } // if (!done && !error && hasBytesAvailable)
4604
+ } // if (!done && !error && !socketEOF && !waiting && hasBytesAvailable)
4604
4605
4605
4606
4606
4607
if (!done && currentRead->readLength == 0 && currentRead->term == nil )
@@ -4612,16 +4613,7 @@ - (void)doReadData
4612
4613
done = (totalBytesReadForCurrentRead > 0 );
4613
4614
}
4614
4615
4615
- // Only one of the following can possibly be true:
4616
- //
4617
- // - waiting
4618
- // - socketEOF
4619
- // - socketError
4620
- // - maxoutError
4621
- //
4622
- // They may all be false.
4623
- // One of the above may be true even if done is true.
4624
- // This might be the case if we completed read type #1 via data from the prebuffer.
4616
+ // Check to see if we're done, or if we've made progress
4625
4617
4626
4618
if (done)
4627
4619
{
0 commit comments