| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // TODO(rjshade): Set appropriate CWND when previous connection was in slow | 100 // TODO(rjshade): Set appropriate CWND when previous connection was in slow |
| 101 // start at time of estimate. | 101 // start at time of estimate. |
| 102 return true; | 102 return true; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void TcpCubicBytesSender::SetNumEmulatedConnections(int num_connections) { | 105 void TcpCubicBytesSender::SetNumEmulatedConnections(int num_connections) { |
| 106 num_connections_ = max(1, num_connections); | 106 num_connections_ = max(1, num_connections); |
| 107 cubic_.SetNumConnections(num_connections_); | 107 cubic_.SetNumConnections(num_connections_); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void TcpCubicBytesSender::SetMaxCongestionWindow( |
| 111 QuicByteCount max_congestion_window) { |
| 112 max_congestion_window_ = max_congestion_window; |
| 113 } |
| 114 |
| 110 float TcpCubicBytesSender::RenoBeta() const { | 115 float TcpCubicBytesSender::RenoBeta() const { |
| 111 // kNConnectionBeta is the backoff factor after loss for our N-connection | 116 // kNConnectionBeta is the backoff factor after loss for our N-connection |
| 112 // emulation, which emulates the effective backoff of an ensemble of N | 117 // emulation, which emulates the effective backoff of an ensemble of N |
| 113 // TCP-Reno connections on a single loss event. The effective multiplier is | 118 // TCP-Reno connections on a single loss event. The effective multiplier is |
| 114 // computed as: | 119 // computed as: |
| 115 return (num_connections_ - 1 + kRenoBeta) / num_connections_; | 120 return (num_connections_ - 1 + kRenoBeta) / num_connections_; |
| 116 } | 121 } |
| 117 | 122 |
| 118 void TcpCubicBytesSender::OnCongestionEvent( | 123 void TcpCubicBytesSender::OnCongestionEvent( |
| 119 bool rtt_updated, | 124 bool rtt_updated, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 hybrid_slow_start_.Restart(); | 352 hybrid_slow_start_.Restart(); |
| 348 slowstart_threshold_ = congestion_window_ / 2; | 353 slowstart_threshold_ = congestion_window_ / 2; |
| 349 congestion_window_ = min_congestion_window_; | 354 congestion_window_ = min_congestion_window_; |
| 350 } | 355 } |
| 351 | 356 |
| 352 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { | 357 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { |
| 353 return reno_ ? kRenoBytes : kCubicBytes; | 358 return reno_ ? kRenoBytes : kCubicBytes; |
| 354 } | 359 } |
| 355 | 360 |
| 356 } // namespace net | 361 } // namespace net |
| OLD | NEW |