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/congestion_control/tcp_cubic_bytes_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "net/quic/congestion_control/prr_sender.h" | 9 #include "net/quic/congestion_control/prr_sender.h" |
10 #include "net/quic/congestion_control/rtt_stats.h" | 10 #include "net/quic/congestion_control/rtt_stats.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 largest_acked_packet_number_ != 0; | 288 largest_acked_packet_number_ != 0; |
289 } | 289 } |
290 | 290 |
291 // Called when we receive an ack. Normal TCP tracks how many packets one ack | 291 // Called when we receive an ack. Normal TCP tracks how many packets one ack |
292 // represents, but quic has a separate ack for each packet. | 292 // represents, but quic has a separate ack for each packet. |
293 void TcpCubicBytesSender::MaybeIncreaseCwnd( | 293 void TcpCubicBytesSender::MaybeIncreaseCwnd( |
294 QuicPacketNumber acked_packet_number, | 294 QuicPacketNumber acked_packet_number, |
295 QuicByteCount acked_bytes, | 295 QuicByteCount acked_bytes, |
296 QuicByteCount bytes_in_flight) { | 296 QuicByteCount bytes_in_flight) { |
297 LOG_IF(DFATAL, InRecovery()) << "Never increase the CWND during recovery."; | 297 LOG_IF(DFATAL, InRecovery()) << "Never increase the CWND during recovery."; |
| 298 // Do not increase the congestion window unless the sender is close to using |
| 299 // the current window. |
298 if (!IsCwndLimited(bytes_in_flight)) { | 300 if (!IsCwndLimited(bytes_in_flight)) { |
299 // Do not increase the congestion window unless the sender is close to using | 301 cubic_.OnApplicationLimited(); |
300 // the current window. | |
301 if (FLAGS_reset_cubic_epoch_when_app_limited) { | |
302 cubic_.OnApplicationLimited(); | |
303 } | |
304 return; | 302 return; |
305 } | 303 } |
306 if (congestion_window_ >= max_congestion_window_) { | 304 if (congestion_window_ >= max_congestion_window_) { |
307 return; | 305 return; |
308 } | 306 } |
309 if (InSlowStart()) { | 307 if (InSlowStart()) { |
310 // TCP slow start, exponential growth, increase by one for each ACK. | 308 // TCP slow start, exponential growth, increase by one for each ACK. |
311 congestion_window_ += kDefaultTCPMSS; | 309 congestion_window_ += kDefaultTCPMSS; |
312 DVLOG(1) << "Slow start; congestion window: " << congestion_window_ | 310 DVLOG(1) << "Slow start; congestion window: " << congestion_window_ |
313 << " slowstart threshold: " << slowstart_threshold_; | 311 << " slowstart threshold: " << slowstart_threshold_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 hybrid_slow_start_.Restart(); | 345 hybrid_slow_start_.Restart(); |
348 slowstart_threshold_ = congestion_window_ / 2; | 346 slowstart_threshold_ = congestion_window_ / 2; |
349 congestion_window_ = min_congestion_window_; | 347 congestion_window_ = min_congestion_window_; |
350 } | 348 } |
351 | 349 |
352 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { | 350 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { |
353 return reno_ ? kRenoBytes : kCubicBytes; | 351 return reno_ ? kRenoBytes : kCubicBytes; |
354 } | 352 } |
355 | 353 |
356 } // namespace net | 354 } // namespace net |
OLD | NEW |