attemping fix for linux Ts/Txul startup regression, b=189567

This commit is contained in:
darin%netscape.com 2003-01-19 20:46:51 +00:00
Родитель 436f9566be
Коммит 8d699694dc
2 изменённых файлов: 15 добавлений и 9 удалений

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

@ -373,13 +373,14 @@ nsInputStreamPump::OnStateTransfer()
}
else if (NS_SUCCEEDED(rv) && avail) {
// figure out how much data to report (XXX detect overflow??)
if (avail + mStreamOffset > mStreamLength) {
if (avail + mStreamOffset > mStreamLength)
avail = mStreamLength - mStreamOffset;
if (avail > mSegSize)
avail = mSegSize;
}
if (avail) {
// XXX need to make max ODA size configurable
if (avail > 16384)
avail = 16384;
LOG((" calling OnDataAvailable [offset=%u count=%u]\n", mStreamOffset, avail));
rv = mListener->OnDataAvailable(this, mListenerContext, mAsyncStream, mStreamOffset, avail);
@ -395,8 +396,14 @@ nsInputStreamPump::OnStateTransfer()
if (NS_SUCCEEDED(mStatus)) {
if (NS_FAILED(rv))
mStatus = rv;
else if (avail)
return STATE_TRANSFER;
else if (avail) {
// if stream is now closed, advance to STATE_STOP right away.
// Available may return 0 bytes available at the moment; that
// would not mean that we are done.
rv = mAsyncStream->Available(&avail);
if (NS_SUCCEEDED(rv))
return STATE_TRANSFER;
}
}
return STATE_STOP;
}

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

@ -613,10 +613,9 @@ nsPipeInputStream::Available(PRUint32 *result)
{
nsAutoMonitor mon(mPipe->Monitor());
// return error if pipe closed with error.
// return error if pipe closed
if (!mAvailable && NS_FAILED(mPipe->mStatus))
if (mPipe->mStatus != NS_BASE_STREAM_CLOSED)
return mPipe->mStatus;
return mPipe->mStatus;
*result = mAvailable;
return NS_OK;