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/rtt_stats.h" | 10 #include "net/quic/congestion_control/rtt_stats.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 return QuicTime::Delta::FromMicroseconds( | 207 return QuicTime::Delta::FromMicroseconds( |
208 rtt_stats_->SmoothedRtt().ToMicroseconds() + | 208 rtt_stats_->SmoothedRtt().ToMicroseconds() + |
209 4 * rtt_stats_->mean_deviation().ToMicroseconds()); | 209 4 * rtt_stats_->mean_deviation().ToMicroseconds()); |
210 } | 210 } |
211 | 211 |
212 QuicByteCount TcpCubicSender::GetCongestionWindow() const { | 212 QuicByteCount TcpCubicSender::GetCongestionWindow() const { |
213 return congestion_window_ * kMaxSegmentSize; | 213 return congestion_window_ * kMaxSegmentSize; |
214 } | 214 } |
215 | 215 |
| 216 QuicByteCount TcpCubicSender::GetSlowStartThreshold() const { |
| 217 return slowstart_threshold_ * kMaxSegmentSize; |
| 218 } |
| 219 |
216 bool TcpCubicSender::IsCwndLimited(QuicByteCount bytes_in_flight) const { | 220 bool TcpCubicSender::IsCwndLimited(QuicByteCount bytes_in_flight) const { |
217 const QuicByteCount congestion_window_bytes = congestion_window_ * | 221 const QuicByteCount congestion_window_bytes = congestion_window_ * |
218 kMaxSegmentSize; | 222 kMaxSegmentSize; |
219 if (bytes_in_flight >= congestion_window_bytes) { | 223 if (bytes_in_flight >= congestion_window_bytes) { |
220 return true; | 224 return true; |
221 } | 225 } |
222 const QuicByteCount max_burst = kMaxBurstLength * kMaxSegmentSize; | 226 const QuicByteCount max_burst = kMaxBurstLength * kMaxSegmentSize; |
223 const QuicByteCount available_bytes = | 227 const QuicByteCount available_bytes = |
224 congestion_window_bytes - bytes_in_flight; | 228 congestion_window_bytes - bytes_in_flight; |
225 const bool slow_start_limited = InSlowStart() && | 229 const bool slow_start_limited = InSlowStart() && |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // AvailableSendWindow = | 339 // AvailableSendWindow = |
336 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent | 340 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent |
337 if (prr_delivered_ * slowstart_threshold_ * kMaxSegmentSize > | 341 if (prr_delivered_ * slowstart_threshold_ * kMaxSegmentSize > |
338 prr_out_ * bytes_in_flight_before_loss_) { | 342 prr_out_ * bytes_in_flight_before_loss_) { |
339 return QuicTime::Delta::Zero(); | 343 return QuicTime::Delta::Zero(); |
340 } | 344 } |
341 return QuicTime::Delta::Infinite(); | 345 return QuicTime::Delta::Infinite(); |
342 } | 346 } |
343 | 347 |
344 } // namespace net | 348 } // namespace net |
OLD | NEW |