Fixed up socket transport to abort the operation if the consumer OnDataAvailable(...) returns a failure...

This commit is contained in:
rpotts%netscape.com 1999-06-29 23:28:19 +00:00
parent 94f842b81e
commit 3eac314475
2 changed files with 15 additions and 4 deletions

View File

@ -294,9 +294,12 @@ nsAsyncStreamObserver::OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
nsresult rv = GetStatus();
if (NS_FAILED(rv)) return rv;
nsresult rv;
//
// The OnStopBindiong event should always be fired, so do not
// check the status...
//
nsOnStopBindingEvent* event =
new nsOnStopBindingEvent(this, context);
if (event == nsnull)

View File

@ -729,8 +729,16 @@ nsresult nsSocketTransport::doRead(PRInt16 aSelectFlags)
// been filled into the stream as possible...
//
if (totalBytesWritten && mReadListener) {
mReadListener->OnDataAvailable(mReadContext, mReadStream, mSourceOffset,
totalBytesWritten);
nsresult rv1;
rv1 = mReadListener->OnDataAvailable(mReadContext, mReadStream, mSourceOffset,
totalBytesWritten);
//
// If the consumer returns failure, then cancel the operation...
//
if (NS_FAILED(rv1)) {
rv = rv1;
}
mSourceOffset += totalBytesWritten;
}
}