OLD | NEW |
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/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/iovector.h" | 8 #include "net/quic/iovector.h" |
9 #include "net/quic/quic_ack_listener_interface.h" | 9 #include "net/quic/quic_ack_listener_interface.h" |
10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 bool flag_value = FLAGS_quic_fix_fin_accounting; | 94 bool flag_value = FLAGS_quic_fix_fin_accounting; |
95 if (!flag_value) { | 95 if (!flag_value) { |
96 if (read_side_closed_) { | 96 if (read_side_closed_) { |
97 DVLOG(1) << ENDPOINT << "Ignoring frame " << frame.stream_id; | 97 DVLOG(1) << ENDPOINT << "Ignoring frame " << frame.stream_id; |
98 // The subclass does not want to read data: blackhole the data. | 98 // The subclass does not want to read data: blackhole the data. |
99 return; | 99 return; |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 if (!FLAGS_quic_stop_checking_for_mismatch_ids && frame.stream_id != id_) { | |
104 session_->connection()->SendConnectionClose(QUIC_INTERNAL_ERROR); | |
105 return; | |
106 } | |
107 | |
108 if (frame.fin) { | 103 if (frame.fin) { |
109 fin_received_ = true; | 104 fin_received_ = true; |
110 if (fin_sent_) { | 105 if (fin_sent_) { |
111 session_->StreamDraining(id_); | 106 session_->StreamDraining(id_); |
112 } | 107 } |
113 } | 108 } |
114 | 109 |
115 if (flag_value) { | 110 if (flag_value) { |
116 if (read_side_closed_) { | 111 if (read_side_closed_) { |
117 DVLOG(1) << ENDPOINT << "Ignoring data in frame " << frame.stream_id; | 112 DVLOG(1) << ENDPOINT << "Ignoring data in frame " << frame.stream_id; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // OnFinRead can be called due to a FIN flag in a headers block, so there may | 174 // OnFinRead can be called due to a FIN flag in a headers block, so there may |
180 // have been no OnStreamFrame call with a FIN in the frame. | 175 // have been no OnStreamFrame call with a FIN in the frame. |
181 fin_received_ = true; | 176 fin_received_ = true; |
182 // If fin_sent_ is true, then CloseWriteSide has already been called, and the | 177 // If fin_sent_ is true, then CloseWriteSide has already been called, and the |
183 // stream will be destroyed by CloseReadSide, so don't need to call | 178 // stream will be destroyed by CloseReadSide, so don't need to call |
184 // StreamDraining. | 179 // StreamDraining. |
185 CloseReadSide(); | 180 CloseReadSide(); |
186 } | 181 } |
187 | 182 |
188 void ReliableQuicStream::Reset(QuicRstStreamErrorCode error) { | 183 void ReliableQuicStream::Reset(QuicRstStreamErrorCode error) { |
189 DCHECK_NE(QUIC_STREAM_NO_ERROR, error); | |
190 stream_error_ = error; | 184 stream_error_ = error; |
191 // Sending a RstStream results in calling CloseStream. | 185 // Sending a RstStream results in calling CloseStream. |
192 session()->SendRstStream(id(), error, stream_bytes_written_); | 186 session()->SendRstStream(id(), error, stream_bytes_written_); |
193 rst_sent_ = true; | 187 rst_sent_ = true; |
194 } | 188 } |
195 | 189 |
196 void ReliableQuicStream::CloseConnection(QuicErrorCode error) { | 190 void ReliableQuicStream::CloseConnection(QuicErrorCode error) { |
197 session()->connection()->SendConnectionClose(error); | 191 session()->connection()->SendConnectionClose(error); |
198 } | 192 } |
199 | 193 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 464 } |
471 } | 465 } |
472 | 466 |
473 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { | 467 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { |
474 if (flow_controller_.UpdateSendWindowOffset(new_window)) { | 468 if (flow_controller_.UpdateSendWindowOffset(new_window)) { |
475 OnCanWrite(); | 469 OnCanWrite(); |
476 } | 470 } |
477 } | 471 } |
478 | 472 |
479 } // namespace net | 473 } // namespace net |
OLD | NEW |