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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 void QuicSpdySession::OnConfigNegotiated() { | 115 void QuicSpdySession::OnConfigNegotiated() { |
116 QuicSession::OnConfigNegotiated(); | 116 QuicSession::OnConfigNegotiated(); |
117 if (config()->HasClientSentConnectionOption(kDHDT, perspective())) { | 117 if (config()->HasClientSentConnectionOption(kDHDT, perspective())) { |
118 headers_stream_->DisableHpackDynamicTable(); | 118 headers_stream_->DisableHpackDynamicTable(); |
119 } | 119 } |
120 const QuicVersion version = connection()->version(); | 120 const QuicVersion version = connection()->version(); |
121 if (FLAGS_quic_enable_force_hol_blocking && version > QUIC_VERSION_35 && | 121 if (FLAGS_quic_enable_force_hol_blocking && version > QUIC_VERSION_35 && |
122 config()->ForceHolBlocking(perspective())) { | 122 config()->ForceHolBlocking(perspective())) { |
123 force_hol_blocking_ = true; | 123 force_hol_blocking_ = true; |
124 // Autotuning makes sure that the headers stream flow control does | 124 if (!FLAGS_quic_bugfix_fhol_writev_fin_only_v2) { |
125 // not get in the way, and normal stream and connection level flow | 125 // Autotuning makes sure that the headers stream flow control does |
126 // control are active anyway. This is really only for the client | 126 // not get in the way, and normal stream and connection level flow |
127 // side (and mainly there just in tests and toys), where | 127 // control are active anyway. This is really only for the client |
128 // autotuning and/or large buffers are not enabled by default. | 128 // side (and mainly there just in tests and toys), where |
129 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); | 129 // autotuning and/or large buffers are not enabled by default. |
| 130 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); |
| 131 } else { |
| 132 // Since all streams are tunneled through the headers stream, it |
| 133 // is important that headers stream never flow control blocks. |
| 134 // Otherwise, busy-loop behaviour can ensue where data streams |
| 135 // data try repeatedly to write data not realizing that the |
| 136 // tunnel through the headers stream is blocked. |
| 137 headers_stream_->flow_controller()->UpdateReceiveWindowSize( |
| 138 kStreamReceiveWindowLimit); |
| 139 headers_stream_->flow_controller()->UpdateSendWindowOffset( |
| 140 kStreamReceiveWindowLimit); |
| 141 } |
130 } | 142 } |
131 | 143 |
132 if (version > QUIC_VERSION_34) { | 144 if (version > QUIC_VERSION_34) { |
133 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; | 145 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; |
134 } | 146 } |
135 } | 147 } |
136 | 148 |
137 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, | 149 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, |
138 const char* data, | 150 const char* data, |
139 size_t len, | 151 size_t len, |
140 bool fin) { | 152 bool fin) { |
141 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 153 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
142 if (stream == nullptr) { | 154 if (stream == nullptr) { |
143 return; | 155 return; |
144 } | 156 } |
145 const QuicStreamOffset offset = | 157 const QuicStreamOffset offset = |
146 stream->flow_controller()->highest_received_byte_offset(); | 158 stream->flow_controller()->highest_received_byte_offset(); |
147 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); | 159 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); |
148 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id | 160 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id |
149 << " offset " << offset << " len " << len << " fin " << fin; | 161 << " offset " << offset << " len " << len << " fin " << fin; |
150 OnStreamFrame(frame); | 162 OnStreamFrame(frame); |
151 } | 163 } |
152 | 164 |
153 bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() { | 165 bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() { |
154 return false; | 166 return false; |
155 } | 167 } |
156 | 168 |
157 } // namespace net | 169 } // namespace net |
OLD | NEW |