Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -327,10 +327,15 @@ * \return The number of bytes written */ - (size_t)writeFormat: (OFString*)fmt withArguments: (va_list)args; +/** + * \return The number of bytes still present in the internal cache. + */ +- (size_t)pendingBytes; + /** * \return Whether the stream is in blocking mode */ - (BOOL)isBlocking; Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -700,10 +700,15 @@ } /* Get rid of a warning, never reached anyway */ assert(0); } + +- (size_t)pendingBytes +{ + return cacheLen; +} - (BOOL)isBlocking { return isBlocking; } Index: src/OFStreamObserver.m ================================================================== --- src/OFStreamObserver.m +++ src/OFStreamObserver.m @@ -358,11 +358,11 @@ cArray = [readStreams cArray]; count = [readStreams count]; for (i = 0; i < count; i++) { - if (cArray[i]->cache != NULL) { + if ([cArray[i] pendingBytes] > 0) { [delegate streamDidBecomeReadyForReading: cArray[i]]; foundInCache = YES; [pool releaseObjects]; } }