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/core/quic_spdy_stream.h" | 5 #include "net/quic/core/quic_spdy_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "net/quic/core/quic_spdy_session.h" | 9 #include "net/quic/core/quic_spdy_session.h" |
10 #include "net/quic/core/quic_utils.h" | 10 #include "net/quic/core/quic_utils.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 sequencer()->SetBlockedUntilFlush(); | 38 sequencer()->SetBlockedUntilFlush(); |
39 spdy_session_->RegisterStreamPriority(id, priority_); | 39 spdy_session_->RegisterStreamPriority(id, priority_); |
40 } | 40 } |
41 | 41 |
42 QuicSpdyStream::~QuicSpdyStream() { | 42 QuicSpdyStream::~QuicSpdyStream() { |
43 if (spdy_session_ != nullptr) { | 43 if (spdy_session_ != nullptr) { |
44 spdy_session_->UnregisterStreamPriority(id()); | 44 spdy_session_->UnregisterStreamPriority(id()); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 void QuicSpdyStream::StopReading() { | |
49 if (!fin_received() && !rst_received() && write_side_closed() && | |
50 !rst_sent()) { | |
51 DCHECK(fin_sent()); | |
52 // Tell the peer to stop sending further data. | |
53 QUIC_DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id(); | |
54 Reset(QUIC_STREAM_NO_ERROR); | |
55 } | |
56 QuicStream::StopReading(); | |
57 } | |
58 | |
59 size_t QuicSpdyStream::WriteHeaders( | 48 size_t QuicSpdyStream::WriteHeaders( |
60 SpdyHeaderBlock header_block, | 49 SpdyHeaderBlock header_block, |
61 bool fin, | 50 bool fin, |
62 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { | 51 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { |
63 size_t bytes_written = spdy_session_->WriteHeaders( | 52 size_t bytes_written = spdy_session_->WriteHeaders( |
64 id(), std::move(header_block), fin, priority_, std::move(ack_listener)); | 53 id(), std::move(header_block), fin, priority_, std::move(ack_listener)); |
65 if (fin) { | 54 if (fin) { |
66 // TODO(rch): Add test to ensure fin_sent_ is set whenever a fin is sent. | 55 // TODO(rch): Add test to ensure fin_sent_ is set whenever a fin is sent. |
67 set_fin_sent(true); | 56 set_fin_sent(true); |
68 CloseWriteSide(); | 57 CloseWriteSide(); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { | 318 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { |
330 if (spdy_session_->headers_stream() != nullptr && | 319 if (spdy_session_->headers_stream() != nullptr && |
331 spdy_session_->force_hol_blocking()) { | 320 spdy_session_->force_hol_blocking()) { |
332 return spdy_session_->WritevStreamData(id(), iov, offset, fin, | 321 return spdy_session_->WritevStreamData(id(), iov, offset, fin, |
333 std::move(ack_listener)); | 322 std::move(ack_listener)); |
334 } | 323 } |
335 return QuicStream::WritevDataInner(iov, offset, fin, std::move(ack_listener)); | 324 return QuicStream::WritevDataInner(iov, offset, fin, std::move(ack_listener)); |
336 } | 325 } |
337 | 326 |
338 } // namespace net | 327 } // namespace net |
OLD | NEW |