| Index: net/base/elements_upload_data_stream.cc
|
| diff --git a/net/base/elements_upload_data_stream.cc b/net/base/elements_upload_data_stream.cc
|
| index bca7d4e7aab0ac1dc2b5d5c019100a8bdff23660..e1b6418439f2443334b7f474c5ed9ff948b0d027 100644
|
| --- a/net/base/elements_upload_data_stream.cc
|
| +++ b/net/base/elements_upload_data_stream.cc
|
| @@ -20,7 +20,7 @@ ElementsUploadDataStream::ElementsUploadDataStream(
|
| : UploadDataStream(false, identifier),
|
| element_readers_(std::move(element_readers)),
|
| element_index_(0),
|
| - read_failed_(false),
|
| + read_failed_(OK),
|
| weak_ptr_factory_(this) {}
|
|
|
| ElementsUploadDataStream::~ElementsUploadDataStream() {
|
| @@ -61,7 +61,7 @@ ElementsUploadDataStream::GetElementReaders() const {
|
|
|
| void ElementsUploadDataStream::ResetInternal() {
|
| weak_ptr_factory_.InvalidateWeakPtrs();
|
| - read_failed_ = false;
|
| + read_failed_ = OK;
|
| element_index_ = 0;
|
| }
|
|
|
| @@ -125,16 +125,8 @@ int ElementsUploadDataStream::ReadElements(
|
| ProcessReadResult(buf, result);
|
| }
|
|
|
| - if (read_failed_) {
|
| - // If an error occured during read operation, then pad with zero.
|
| - // Otherwise the server will hang waiting for the rest of the data.
|
| - int num_bytes_to_fill =
|
| - static_cast<int>(std::min(static_cast<uint64_t>(buf->BytesRemaining()),
|
| - size() - position() - buf->BytesConsumed()));
|
| - DCHECK_GE(num_bytes_to_fill, 0);
|
| - memset(buf->data(), 0, num_bytes_to_fill);
|
| - buf->DidConsume(num_bytes_to_fill);
|
| - }
|
| + if (read_failed_ != OK)
|
| + return read_failed_;
|
|
|
| return buf->BytesConsumed();
|
| }
|
| @@ -158,7 +150,7 @@ void ElementsUploadDataStream::ProcessReadResult(
|
| if (result >= 0) {
|
| buf->DidConsume(result);
|
| } else {
|
| - read_failed_ = true;
|
| + read_failed_ = result;
|
| }
|
| }
|
|
|
|
|