OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_session.h" | 5 #include "net/quic/core/quic_spdy_session.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "net/quic/core/quic_bug_tracker.h" | 9 #include "net/quic/core/quic_bug_tracker.h" |
10 #include "net/quic/core/quic_headers_stream.h" | 10 #include "net/quic/core/quic_headers_stream.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 void QuicSpdySession::OnConfigNegotiated() { | 152 void QuicSpdySession::OnConfigNegotiated() { |
153 QuicSession::OnConfigNegotiated(); | 153 QuicSession::OnConfigNegotiated(); |
154 if (config()->HasClientSentConnectionOption(kDHDT, perspective())) { | 154 if (config()->HasClientSentConnectionOption(kDHDT, perspective())) { |
155 headers_stream_->DisableHpackDynamicTable(); | 155 headers_stream_->DisableHpackDynamicTable(); |
156 } | 156 } |
157 const QuicVersion version = connection()->version(); | 157 const QuicVersion version = connection()->version(); |
158 if (version > QUIC_VERSION_35 && config()->ForceHolBlocking(perspective())) { | 158 if (version > QUIC_VERSION_35 && config()->ForceHolBlocking(perspective())) { |
159 force_hol_blocking_ = true; | 159 force_hol_blocking_ = true; |
160 // Autotuning makes sure that the headers stream flow control does | 160 if (!FLAGS_quic_bugfix_fhol_writev_fin_only_v2) { |
161 // not get in the way, and normal stream and connection level flow | 161 // Autotuning makes sure that the headers stream flow control does |
162 // control are active anyway. This is really only for the client | 162 // not get in the way, and normal stream and connection level flow |
163 // side (and mainly there just in tests and toys), where | 163 // control are active anyway. This is really only for the client |
164 // autotuning and/or large buffers are not enabled by default. | 164 // side (and mainly there just in tests and toys), where |
165 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); | 165 // autotuning and/or large buffers are not enabled by default. |
| 166 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); |
| 167 } else { |
| 168 // Since all streams are tunneled through the headers stream, it |
| 169 // is important that headers stream never flow control blocks. |
| 170 // Otherwise, busy-loop behaviour can ensue where data streams |
| 171 // data try repeatedly to write data not realizing that the |
| 172 // tunnel through the headers stream is blocked. |
| 173 headers_stream_->flow_controller()->UpdateReceiveWindowSize( |
| 174 kStreamReceiveWindowLimit); |
| 175 headers_stream_->flow_controller()->UpdateSendWindowOffset( |
| 176 kStreamReceiveWindowLimit); |
| 177 } |
166 } | 178 } |
167 | 179 |
168 if (version > QUIC_VERSION_34) { | 180 if (version > QUIC_VERSION_34) { |
169 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; | 181 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; |
170 } | 182 } |
171 } | 183 } |
172 | 184 |
173 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, | 185 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, |
174 const char* data, | 186 const char* data, |
175 size_t len, | 187 size_t len, |
176 bool fin) { | 188 bool fin) { |
177 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 189 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
178 if (stream == nullptr) { | 190 if (stream == nullptr) { |
179 return; | 191 return; |
180 } | 192 } |
181 const QuicStreamOffset offset = | 193 const QuicStreamOffset offset = |
182 stream->flow_controller()->highest_received_byte_offset(); | 194 stream->flow_controller()->highest_received_byte_offset(); |
183 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); | 195 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); |
184 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id | 196 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id |
185 << " offset " << offset << " len " << len << " fin " << fin; | 197 << " offset " << offset << " len " << len << " fin " << fin; |
186 OnStreamFrame(frame); | 198 OnStreamFrame(frame); |
187 } | 199 } |
188 | 200 |
189 } // namespace net | 201 } // namespace net |
OLD | NEW |