From 40e0f4af986426681e01f9c81e2194db985ad5d3 Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Fri, 11 Jun 1999 08:25:57 +0000 Subject: [PATCH] if no more data is available when reading a non-blocking input stream then return either WOULD_BLOCK or NS_OK... But exit the loop to prevent spinning! --- xpcom/io/nsPipe.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xpcom/io/nsPipe.cpp b/xpcom/io/nsPipe.cpp index 3541b36e0047..0972735fea13 100644 --- a/xpcom/io/nsPipe.cpp +++ b/xpcom/io/nsPipe.cpp @@ -174,6 +174,10 @@ nsBufferInputStream::Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount) if (amt == 0) { rv = Fill(); if (NS_FAILED(rv)) return rv; + if (!mBlocking) { + // Only return WOULD_BLOCK if no data was read... + return *aReadCount > 0 ? NS_OK : rv; + } } else { *aReadCount += amt;