| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // TODO(rjshade): Set appropriate CWND when previous connection was in slow | 101 // TODO(rjshade): Set appropriate CWND when previous connection was in slow |
| 102 // start at time of estimate. | 102 // start at time of estimate. |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void TcpCubicSender::SetNumEmulatedConnections(int num_connections) { | 106 void TcpCubicSender::SetNumEmulatedConnections(int num_connections) { |
| 107 num_connections_ = max(1, num_connections); | 107 num_connections_ = max(1, num_connections); |
| 108 cubic_.SetNumConnections(num_connections_); | 108 cubic_.SetNumConnections(num_connections_); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void TcpCubicSender::SetMaxCongestionWindow( |
| 112 QuicByteCount max_congestion_window) { |
| 113 max_tcp_congestion_window_ = max_congestion_window / kMaxPacketSize; |
| 114 } |
| 115 |
| 111 float TcpCubicSender::RenoBeta() const { | 116 float TcpCubicSender::RenoBeta() const { |
| 112 // kNConnectionBeta is the backoff factor after loss for our N-connection | 117 // kNConnectionBeta is the backoff factor after loss for our N-connection |
| 113 // emulation, which emulates the effective backoff of an ensemble of N | 118 // emulation, which emulates the effective backoff of an ensemble of N |
| 114 // TCP-Reno connections on a single loss event. The effective multiplier is | 119 // TCP-Reno connections on a single loss event. The effective multiplier is |
| 115 // computed as: | 120 // computed as: |
| 116 return (num_connections_ - 1 + kRenoBeta) / num_connections_; | 121 return (num_connections_ - 1 + kRenoBeta) / num_connections_; |
| 117 } | 122 } |
| 118 | 123 |
| 119 void TcpCubicSender::OnCongestionEvent( | 124 void TcpCubicSender::OnCongestionEvent( |
| 120 bool rtt_updated, | 125 bool rtt_updated, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 hybrid_slow_start_.Restart(); | 357 hybrid_slow_start_.Restart(); |
| 353 slowstart_threshold_ = congestion_window_ / 2; | 358 slowstart_threshold_ = congestion_window_ / 2; |
| 354 congestion_window_ = min_congestion_window_; | 359 congestion_window_ = min_congestion_window_; |
| 355 } | 360 } |
| 356 | 361 |
| 357 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 362 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
| 358 return reno_ ? kReno : kCubic; | 363 return reno_ ? kReno : kCubic; |
| 359 } | 364 } |
| 360 | 365 |
| 361 } // namespace net | 366 } // namespace net |
| OLD | NEW |