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!

This commit is contained in:
rpotts%netscape.com 1999-06-11 08:25:57 +00:00
Родитель 05b81531f8
Коммит 40e0f4af98
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -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;