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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 QuicTime /* now */, | 208 QuicTime /* now */, |
209 QuicByteCount bytes_in_flight, | 209 QuicByteCount bytes_in_flight, |
210 HasRetransmittableData has_retransmittable_data) const { | 210 HasRetransmittableData has_retransmittable_data) const { |
211 if (has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { | 211 if (has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { |
212 // For TCP we can always send an ACK immediately. | 212 // For TCP we can always send an ACK immediately. |
213 return QuicTime::Delta::Zero(); | 213 return QuicTime::Delta::Zero(); |
214 } | 214 } |
215 if (InRecovery()) { | 215 if (InRecovery()) { |
216 // PRR is used when in recovery. | 216 // PRR is used when in recovery. |
217 return prr_.TimeUntilSend(GetCongestionWindow(), bytes_in_flight, | 217 return prr_.TimeUntilSend(GetCongestionWindow(), bytes_in_flight, |
218 slowstart_threshold_); | 218 slowstart_threshold_ * kMaxSegmentSize); |
219 } | 219 } |
220 if (GetCongestionWindow() > bytes_in_flight) { | 220 if (GetCongestionWindow() > bytes_in_flight) { |
221 return QuicTime::Delta::Zero(); | 221 return QuicTime::Delta::Zero(); |
222 } | 222 } |
223 return QuicTime::Delta::Infinite(); | 223 return QuicTime::Delta::Infinite(); |
224 } | 224 } |
225 | 225 |
226 QuicBandwidth TcpCubicSender::PacingRate() const { | 226 QuicBandwidth TcpCubicSender::PacingRate() const { |
227 // We pace at twice the rate of the underlying sender's bandwidth estimate | 227 // We pace at twice the rate of the underlying sender's bandwidth estimate |
228 // during slow start and 1.25x during congestion avoidance to ensure pacing | 228 // during slow start and 1.25x during congestion avoidance to ensure pacing |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 hybrid_slow_start_.Restart(); | 338 hybrid_slow_start_.Restart(); |
339 slowstart_threshold_ = congestion_window_ / 2; | 339 slowstart_threshold_ = congestion_window_ / 2; |
340 congestion_window_ = kMinimumCongestionWindow; | 340 congestion_window_ = kMinimumCongestionWindow; |
341 } | 341 } |
342 | 342 |
343 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 343 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
344 return reno_ ? kReno : kCubic; | 344 return reno_ ? kReno : kCubic; |
345 } | 345 } |
346 | 346 |
347 } // namespace net | 347 } // namespace net |
OLD | NEW |