Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: net/quic/quic_http_stream.cc

Issue 2035643002: Introduce error handling in QuicHttpStream on UploadDataStream::Read() failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove 1 sec delay Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_http_stream.h" 5 #include "net/quic/quic_http_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 699 }
700 700
701 int QuicHttpStream::DoReadRequestBody() { 701 int QuicHttpStream::DoReadRequestBody() {
702 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; 702 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE;
703 return request_body_stream_->Read( 703 return request_body_stream_->Read(
704 raw_request_body_buf_.get(), raw_request_body_buf_->size(), 704 raw_request_body_buf_.get(), raw_request_body_buf_->size(),
705 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); 705 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr()));
706 } 706 }
707 707
708 int QuicHttpStream::DoReadRequestBodyComplete(int rv) { 708 int QuicHttpStream::DoReadRequestBodyComplete(int rv) {
709 // |rv| is the result of read from the request body from the last call to
710 // DoSendBody().
711 if (rv < 0)
712 return rv;
713
714 // If the stream is already closed, don't continue. 709 // If the stream is already closed, don't continue.
715 if (!stream_) 710 if (!stream_)
716 return response_status_; 711 return response_status_;
717 712
713 // |rv| is the result of read from the request body from the last call to
714 // DoSendBody().
715 if (rv < 0) {
716 stream_->SetDelegate(nullptr);
717 stream_->Reset(QUIC_ERROR_PROCESSING_STREAM);
718 ResetStream();
719 return rv;
720 }
721
718 request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), rv); 722 request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), rv);
719 if (rv == 0) { // Reached the end. 723 if (rv == 0) { // Reached the end.
720 DCHECK(request_body_stream_->IsEOF()); 724 DCHECK(request_body_stream_->IsEOF());
721 } 725 }
722 726
723 next_state_ = STATE_SEND_BODY; 727 next_state_ = STATE_SEND_BODY;
724 return OK; 728 return OK;
725 } 729 }
726 730
727 int QuicHttpStream::DoSendBody() { 731 int QuicHttpStream::DoSendBody() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 816 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
813 stream_ = nullptr; 817 stream_ = nullptr;
814 818
815 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 819 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
816 // read. 820 // read.
817 if (request_body_stream_) 821 if (request_body_stream_)
818 request_body_stream_->Reset(); 822 request_body_stream_->Reset();
819 } 823 }
820 824
821 } // namespace net 825 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698