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 if (!FLAGS_quic_bugfix_fhol_writev_fin_only_v2) { | 160 // Autotuning makes sure that the headers stream flow control does |
161 // Autotuning makes sure that the headers stream flow control does | 161 // not get in the way, and normal stream and connection level flow |
162 // not get in the way, and normal stream and connection level flow | 162 // control are active anyway. This is really only for the client |
163 // control are active anyway. This is really only for the client | 163 // side (and mainly there just in tests and toys), where |
164 // side (and mainly there just in tests and toys), where | 164 // autotuning and/or large buffers are not enabled by default. |
165 // autotuning and/or large buffers are not enabled by default. | 165 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); |
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 } | |
178 } | 166 } |
179 | 167 |
180 if (version > QUIC_VERSION_34) { | 168 if (version > QUIC_VERSION_34) { |
181 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; | 169 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; |
182 } | 170 } |
183 } | 171 } |
184 | 172 |
185 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, | 173 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, |
186 const char* data, | 174 const char* data, |
187 size_t len, | 175 size_t len, |
188 bool fin) { | 176 bool fin) { |
189 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 177 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
190 if (stream == nullptr) { | 178 if (stream == nullptr) { |
191 return; | 179 return; |
192 } | 180 } |
193 const QuicStreamOffset offset = | 181 const QuicStreamOffset offset = |
194 stream->flow_controller()->highest_received_byte_offset(); | 182 stream->flow_controller()->highest_received_byte_offset(); |
195 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); | 183 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); |
196 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id | 184 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id |
197 << " offset " << offset << " len " << len << " fin " << fin; | 185 << " offset " << offset << " len " << len << " fin " << fin; |
198 OnStreamFrame(frame); | 186 OnStreamFrame(frame); |
199 } | 187 } |
200 | 188 |
201 } // namespace net | 189 } // namespace net |
OLD | NEW |