From ca2c7d93538fa89395b8c5e514afaded70e1b9e7 Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Thu, 13 Aug 1998 08:19:49 +0000 Subject: [PATCH] Fixed OnDataAvailable(...) to abort the stream if it returns a failure code... --- network/module/nsNetStream.cpp | 2 +- network/module/nsStubContext.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/network/module/nsNetStream.cpp b/network/module/nsNetStream.cpp index c27b1f8a6a68..1de3472c7ed6 100644 --- a/network/module/nsNetStream.cpp +++ b/network/module/nsNetStream.cpp @@ -556,7 +556,7 @@ nsresult nsBlockingStream::Write(const char *aBuf, PRInt32 *aWriteCount) { PRInt32 bytesFree; - nsresult rv; + nsresult rv = NS_OK; LockStream(); diff --git a/network/module/nsStubContext.cpp b/network/module/nsStubContext.cpp index 64ac5bc47a54..317abdc1f932 100644 --- a/network/module/nsStubContext.cpp +++ b/network/module/nsStubContext.cpp @@ -560,7 +560,11 @@ int stub_put_block(NET_StreamClass *stream, const char *buffer, int32 length) errorCode = pConn->pConsumer->OnDataAvailable(pConn->pURL, pConn->pNetStream, bytesWritten); } - return ((NS_OK == errorCode) && (bytesWritten == length)); + /* Abort the connection if an error occurred... */ + if (NS_FAILED(errorCode) || (bytesWritten != length)) { + return -1; + } + return 1; } unsigned int stub_is_write_ready(NET_StreamClass *stream)