| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_spdy_stream.h" | 5 #include "net/quic/quic_spdy_stream.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 spdy_session_->RegisterStreamPriority(id, priority_); | 40 spdy_session_->RegisterStreamPriority(id, priority_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 QuicSpdyStream::~QuicSpdyStream() { | 43 QuicSpdyStream::~QuicSpdyStream() { |
| 44 if (spdy_session_ != nullptr) { | 44 if (spdy_session_ != nullptr) { |
| 45 spdy_session_->UnregisterStreamPriority(id()); | 45 spdy_session_->UnregisterStreamPriority(id()); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 void QuicSpdyStream::CloseWriteSide() { | 49 void QuicSpdyStream::CloseWriteSide() { |
| 50 if (version() > QUIC_VERSION_28 && !fin_received() && !rst_received() && | 50 if (!fin_received() && !rst_received() && sequencer()->ignore_read_data() && |
| 51 sequencer()->ignore_read_data() && !rst_sent()) { | 51 !rst_sent()) { |
| 52 DCHECK(fin_sent()); | 52 DCHECK(fin_sent()); |
| 53 // Tell the peer to stop sending further data. | 53 // Tell the peer to stop sending further data. |
| 54 DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id(); | 54 DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id(); |
| 55 Reset(QUIC_STREAM_NO_ERROR); | 55 Reset(QUIC_STREAM_NO_ERROR); |
| 56 } | 56 } |
| 57 | 57 |
| 58 ReliableQuicStream::CloseWriteSide(); | 58 ReliableQuicStream::CloseWriteSide(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void QuicSpdyStream::StopReading() { | 61 void QuicSpdyStream::StopReading() { |
| 62 if (version() > QUIC_VERSION_28 && !fin_received() && !rst_received() && | 62 if (!fin_received() && !rst_received() && write_side_closed() && |
| 63 write_side_closed() && !rst_sent()) { | 63 !rst_sent()) { |
| 64 DCHECK(fin_sent()); | 64 DCHECK(fin_sent()); |
| 65 // Tell the peer to stop sending further data. | 65 // Tell the peer to stop sending further data. |
| 66 DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id(); | 66 DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id(); |
| 67 Reset(QUIC_STREAM_NO_ERROR); | 67 Reset(QUIC_STREAM_NO_ERROR); |
| 68 } | 68 } |
| 69 ReliableQuicStream::StopReading(); | 69 ReliableQuicStream::StopReading(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 size_t QuicSpdyStream::WriteHeaders( | 72 size_t QuicSpdyStream::WriteHeaders( |
| 73 SpdyHeaderBlock header_block, | 73 SpdyHeaderBlock header_block, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 session()->connection()->CloseConnection( | 325 session()->connection()->CloseConnection( |
| 326 QUIC_INVALID_HEADERS_STREAM_DATA, "Trailers are malformed", | 326 QUIC_INVALID_HEADERS_STREAM_DATA, "Trailers are malformed", |
| 327 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 327 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 328 return; | 328 return; |
| 329 } | 329 } |
| 330 OnStreamFrame(QuicStreamFrame(id(), fin, final_byte_offset, StringPiece())); | 330 OnStreamFrame(QuicStreamFrame(id(), fin, final_byte_offset, StringPiece())); |
| 331 trailers_decompressed_ = true; | 331 trailers_decompressed_ = true; |
| 332 } | 332 } |
| 333 | 333 |
| 334 void QuicSpdyStream::OnStreamReset(const QuicRstStreamFrame& frame) { | 334 void QuicSpdyStream::OnStreamReset(const QuicRstStreamFrame& frame) { |
| 335 if (frame.error_code != QUIC_STREAM_NO_ERROR || | 335 if (frame.error_code != QUIC_STREAM_NO_ERROR) { |
| 336 version() <= QUIC_VERSION_28) { | |
| 337 ReliableQuicStream::OnStreamReset(frame); | 336 ReliableQuicStream::OnStreamReset(frame); |
| 338 return; | 337 return; |
| 339 } | 338 } |
| 340 DVLOG(1) << "Received QUIC_STREAM_NO_ERROR, not discarding response"; | 339 DVLOG(1) << "Received QUIC_STREAM_NO_ERROR, not discarding response"; |
| 341 set_rst_received(true); | 340 set_rst_received(true); |
| 342 MaybeIncreaseHighestReceivedOffset(frame.byte_offset); | 341 MaybeIncreaseHighestReceivedOffset(frame.byte_offset); |
| 343 set_stream_error(frame.error_code); | 342 set_stream_error(frame.error_code); |
| 344 CloseWriteSide(); | 343 CloseWriteSide(); |
| 345 } | 344 } |
| 346 | 345 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (spdy_session_->headers_stream() != nullptr && | 409 if (spdy_session_->headers_stream() != nullptr && |
| 411 spdy_session_->force_hol_blocking()) { | 410 spdy_session_->force_hol_blocking()) { |
| 412 return spdy_session_->headers_stream()->WritevStreamData( | 411 return spdy_session_->headers_stream()->WritevStreamData( |
| 413 id(), iov, offset, fin, ack_notifier_delegate); | 412 id(), iov, offset, fin, ack_notifier_delegate); |
| 414 } | 413 } |
| 415 return ReliableQuicStream::WritevDataInner(iov, offset, fin, | 414 return ReliableQuicStream::WritevDataInner(iov, offset, fin, |
| 416 ack_notifier_delegate); | 415 ack_notifier_delegate); |
| 417 } | 416 } |
| 418 | 417 |
| 419 } // namespace net | 418 } // namespace net |
| OLD | NEW |