OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_flow_controller.h" | 5 #include "net/quic/core/quic_flow_controller.h" |
6 | 6 |
7 #include <cstdint> | 7 #include <cstdint> |
8 | 8 |
9 #include "net/quic/core/quic_connection.h" | 9 #include "net/quic/core/quic_connection.h" |
10 #include "net/quic/core/quic_packets.h" | 10 #include "net/quic/core/quic_packets.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 | 180 |
181 void QuicFlowController::MaybeSendWindowUpdate() { | 181 void QuicFlowController::MaybeSendWindowUpdate() { |
182 // Send WindowUpdate to increase receive window if | 182 // Send WindowUpdate to increase receive window if |
183 // (receive window offset - consumed bytes) < (max window / 2). | 183 // (receive window offset - consumed bytes) < (max window / 2). |
184 // This is behaviour copied from SPDY. | 184 // This is behaviour copied from SPDY. |
185 DCHECK_LE(bytes_consumed_, receive_window_offset_); | 185 DCHECK_LE(bytes_consumed_, receive_window_offset_); |
186 QuicStreamOffset available_window = receive_window_offset_ - bytes_consumed_; | 186 QuicStreamOffset available_window = receive_window_offset_ - bytes_consumed_; |
187 QuicByteCount threshold = WindowUpdateThreshold(); | 187 QuicByteCount threshold = WindowUpdateThreshold(); |
188 | 188 |
189 if (FLAGS_quic_reloadable_flag_quic_flow_control_faster_autotune && | 189 if (!prev_window_update_time_.IsInitialized()) { |
190 !prev_window_update_time_.IsInitialized()) { | |
191 QUIC_FLAG_COUNT(quic_reloadable_flag_quic_flow_control_faster_autotune); | |
192 // Treat the initial window as if it is a window update, so if 1/2 the | 190 // Treat the initial window as if it is a window update, so if 1/2 the |
193 // window is used in less than 2 RTTs, the window is increased. | 191 // window is used in less than 2 RTTs, the window is increased. |
194 prev_window_update_time_ = connection_->clock()->ApproximateNow(); | 192 prev_window_update_time_ = connection_->clock()->ApproximateNow(); |
195 } | 193 } |
196 | 194 |
197 if (available_window >= threshold) { | 195 if (available_window >= threshold) { |
198 QUIC_DVLOG(1) << ENDPOINT << "Not sending WindowUpdate for stream " << id_ | 196 QUIC_DVLOG(1) << ENDPOINT << "Not sending WindowUpdate for stream " << id_ |
199 << ", available window: " << available_window | 197 << ", available window: " << available_window |
200 << " >= threshold: " << threshold; | 198 << " >= threshold: " << threshold; |
201 return; | 199 return; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 288 } |
291 receive_window_size_ = size; | 289 receive_window_size_ = size; |
292 receive_window_offset_ = size; | 290 receive_window_offset_ = size; |
293 } | 291 } |
294 | 292 |
295 void QuicFlowController::SendWindowUpdate() { | 293 void QuicFlowController::SendWindowUpdate() { |
296 connection_->SendWindowUpdate(id_, receive_window_offset_); | 294 connection_->SendWindowUpdate(id_, receive_window_offset_); |
297 } | 295 } |
298 | 296 |
299 } // namespace net | 297 } // namespace net |
OLD | NEW |