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 | 10 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 QuicTime::Delta TcpCubicSender::RetransmissionDelay() const { | 234 QuicTime::Delta TcpCubicSender::RetransmissionDelay() const { |
235 return QuicTime::Delta::FromMicroseconds( | 235 return QuicTime::Delta::FromMicroseconds( |
236 smoothed_rtt_.ToMicroseconds() + 4 * mean_deviation_.ToMicroseconds()); | 236 smoothed_rtt_.ToMicroseconds() + 4 * mean_deviation_.ToMicroseconds()); |
237 } | 237 } |
238 | 238 |
239 QuicByteCount TcpCubicSender::GetCongestionWindow() const { | 239 QuicByteCount TcpCubicSender::GetCongestionWindow() const { |
240 return congestion_window_ * kMaxSegmentSize; | 240 return congestion_window_ * kMaxSegmentSize; |
241 } | 241 } |
242 | 242 |
243 void TcpCubicSender::Reset() { | |
244 delay_min_ = QuicTime::Delta::Zero(); | |
245 hybrid_slow_start_.Restart(); | |
246 } | |
247 | |
248 bool TcpCubicSender::IsCwndLimited() const { | 243 bool TcpCubicSender::IsCwndLimited() const { |
249 const QuicByteCount congestion_window_bytes = congestion_window_ * | 244 const QuicByteCount congestion_window_bytes = congestion_window_ * |
250 kMaxSegmentSize; | 245 kMaxSegmentSize; |
251 if (bytes_in_flight_ >= congestion_window_bytes) { | 246 if (bytes_in_flight_ >= congestion_window_bytes) { |
252 return true; | 247 return true; |
253 } | 248 } |
254 const QuicByteCount tcp_max_burst = kMaxBurstLength * kMaxSegmentSize; | 249 const QuicByteCount tcp_max_burst = kMaxBurstLength * kMaxSegmentSize; |
255 const QuicByteCount left = congestion_window_bytes - bytes_in_flight_; | 250 const QuicByteCount left = congestion_window_bytes - bytes_in_flight_; |
256 return left <= tcp_max_burst; | 251 return left <= tcp_max_burst; |
257 } | 252 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 hybrid_slow_start_.Reset(end_sequence_number_); | 358 hybrid_slow_start_.Reset(end_sequence_number_); |
364 } | 359 } |
365 hybrid_slow_start_.Update(rtt, delay_min_); | 360 hybrid_slow_start_.Update(rtt, delay_min_); |
366 if (hybrid_slow_start_.Exit()) { | 361 if (hybrid_slow_start_.Exit()) { |
367 slowstart_threshold_ = congestion_window_; | 362 slowstart_threshold_ = congestion_window_; |
368 } | 363 } |
369 } | 364 } |
370 } | 365 } |
371 | 366 |
372 } // namespace net | 367 } // namespace net |
OLD | NEW |