diff options
author | rtenneti <rtenneti@chromium.org> | 2015-08-25 17:10:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-26 00:10:49 +0000 |
commit | 1e777fa085309dbf9a11cd977ffad077ddcd9fc3 (patch) | |
tree | e43317c0e1ace9924b9d43a501a13a3ab6f4b56a /net/quic/quic_http_stream.cc | |
parent | 56244390ea1e43c8ac59adde8228c0e0e5c33aae (diff) | |
download | chromium_src-1e777fa085309dbf9a11cd977ffad077ddcd9fc3.zip chromium_src-1e777fa085309dbf9a11cd977ffad077ddcd9fc3.tar.gz chromium_src-1e777fa085309dbf9a11cd977ffad077ddcd9fc3.tar.bz2 |
QUIC - initialize closed_stream_received_bytes_ before setting stream_ to NULL.
Moved the common code into a method and called it.
BUG=522263
R=sclittle@chromium.org
TBR=rch@chromium.org
Review URL: https://codereview.chromium.org/1312903003
Cr-Commit-Position: refs/heads/master@{#345495}
Diffstat (limited to 'net/quic/quic_http_stream.cc')
-rw-r--r-- | net/quic/quic_http_stream.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc index a7fd59d..ab46a6d 100644 --- a/net/quic/quic_http_stream.cc +++ b/net/quic/quic_http_stream.cc @@ -222,10 +222,9 @@ int QuicHttpStream::ReadResponseBody( void QuicHttpStream::Close(bool not_reusable) { // Note: the not_reusable flag has no meaning for SPDY streams. if (stream_) { - closed_stream_received_bytes_ = stream_->stream_bytes_read(); stream_->SetDelegate(nullptr); stream_->Reset(QUIC_STREAM_CANCELLED); - stream_ = nullptr; + ResetStream(); response_status_ = was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED : ERR_QUIC_HANDSHAKE_FAILED; } @@ -329,14 +328,13 @@ void QuicHttpStream::OnClose(QuicErrorCode error) { response_status_ = ERR_ABORTED; } - closed_stream_received_bytes_ = stream_->stream_bytes_read(); - stream_ = nullptr; + ResetStream(); if (!callback_.is_null()) DoCallback(response_status_); } void QuicHttpStream::OnError(int error) { - stream_ = nullptr; + ResetStream(); response_status_ = was_handshake_confirmed_ ? error : ERR_QUIC_HANDSHAKE_FAILED; if (!callback_.is_null()) @@ -538,7 +536,7 @@ int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { if (stream_->IsDoneReading()) { stream_->SetDelegate(nullptr); stream_->OnFinRead(); - stream_ = nullptr; + ResetStream(); } return rv; } @@ -547,6 +545,13 @@ SpdyMajorVersion QuicHttpStream::GetSpdyVersion() { return SpdyUtils::GetSpdyVersionForQuicVersion(stream_->version()); } +void QuicHttpStream::ResetStream() { + if (!stream_) + return; + closed_stream_received_bytes_ = stream_->stream_bytes_read(); + stream_ = nullptr; +} + void QuicHttpStream::CrashIfInvalid() const { #ifdef TEMP_INSTRUMENTATION_468529 Liveness liveness = liveness_; |