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_packets.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 TcpCubicSenderPackets::~TcpCubicSenderPackets() {} | 47 TcpCubicSenderPackets::~TcpCubicSenderPackets() {} |
48 | 48 |
49 void TcpCubicSenderPackets::SetCongestionWindowFromBandwidthAndRtt( | 49 void TcpCubicSenderPackets::SetCongestionWindowFromBandwidthAndRtt( |
50 QuicBandwidth bandwidth, | 50 QuicBandwidth bandwidth, |
51 QuicTime::Delta rtt) { | 51 QuicTime::Delta rtt) { |
52 QuicPacketCount new_congestion_window = | 52 QuicPacketCount new_congestion_window = |
53 bandwidth.ToBytesPerPeriod(rtt) / kDefaultTCPMSS; | 53 bandwidth.ToBytesPerPeriod(rtt) / kDefaultTCPMSS; |
54 if (FLAGS_quic_no_lower_bw_resumption_limit) { | 54 if (FLAGS_quic_no_lower_bw_resumption_limit) { |
55 // Limit new CWND to be in the range [1, kMaxCongestionWindow]. | 55 // Limit new CWND to be in the range [1, kMaxCongestionWindow]. |
56 congestion_window_ = max(min_congestion_window_, | 56 congestion_window_ = |
57 min(new_congestion_window, kMaxCongestionWindow)); | 57 max(min_congestion_window_, |
| 58 min(new_congestion_window, kMaxResumptionCongestionWindow)); |
58 } else { | 59 } else { |
59 congestion_window_ = max(min(new_congestion_window, kMaxCongestionWindow), | 60 congestion_window_ = |
60 kMinCongestionWindowForBandwidthResumption); | 61 max(min(new_congestion_window, kMaxResumptionCongestionWindow), |
| 62 kMinCongestionWindowForBandwidthResumption); |
61 } | 63 } |
62 } | 64 } |
63 | 65 |
64 void TcpCubicSenderPackets::SetCongestionWindowInPackets( | 66 void TcpCubicSenderPackets::SetCongestionWindowInPackets( |
65 QuicPacketCount congestion_window) { | 67 QuicPacketCount congestion_window) { |
66 congestion_window_ = congestion_window; | 68 congestion_window_ = congestion_window; |
67 } | 69 } |
68 | 70 |
69 void TcpCubicSenderPackets::SetMinCongestionWindowInPackets( | 71 void TcpCubicSenderPackets::SetMinCongestionWindowInPackets( |
70 QuicPacketCount congestion_window) { | 72 QuicPacketCount congestion_window) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 congestion_window_ = initial_tcp_congestion_window_; | 213 congestion_window_ = initial_tcp_congestion_window_; |
212 slowstart_threshold_ = initial_max_tcp_congestion_window_; | 214 slowstart_threshold_ = initial_max_tcp_congestion_window_; |
213 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; | 215 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; |
214 } | 216 } |
215 | 217 |
216 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const { | 218 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const { |
217 return reno_ ? kReno : kCubic; | 219 return reno_ ? kReno : kCubic; |
218 } | 220 } |
219 | 221 |
220 } // namespace net | 222 } // namespace net |
OLD | NEW |