| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 DVLOG(1) << "Cubic; congestion window: " << congestion_window_ | 262 DVLOG(1) << "Cubic; congestion window: " << congestion_window_ |
| 263 << " slowstart threshold: " << slowstart_threshold_; | 263 << " slowstart threshold: " << slowstart_threshold_; |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 | 266 |
| 267 void TcpCubicSender::OnRetransmissionTimeout(bool packets_retransmitted) { | 267 void TcpCubicSender::OnRetransmissionTimeout(bool packets_retransmitted) { |
| 268 bytes_in_flight_ = 0; | 268 bytes_in_flight_ = 0; |
| 269 largest_sent_at_last_cutback_ = 0; | 269 largest_sent_at_last_cutback_ = 0; |
| 270 if (packets_retransmitted) { | 270 if (packets_retransmitted) { |
| 271 cubic_.Reset(); | 271 cubic_.Reset(); |
| 272 hybrid_slow_start_.Restart(); |
| 272 congestion_window_ = kMinimumCongestionWindow; | 273 congestion_window_ = kMinimumCongestionWindow; |
| 273 } | 274 } |
| 274 } | 275 } |
| 275 | 276 |
| 276 void TcpCubicSender::UpdateRtt(QuicTime::Delta rtt) { | 277 void TcpCubicSender::UpdateRtt(QuicTime::Delta rtt) { |
| 277 // Hybrid start triggers when cwnd is larger than some threshold. | |
| 278 if (InSlowStart() && | 278 if (InSlowStart() && |
| 279 hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_, congestion_window_)) { | 279 hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_, congestion_window_)) { |
| 280 slowstart_threshold_ = congestion_window_; | 280 slowstart_threshold_ = congestion_window_; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 void TcpCubicSender::PrrOnPacketLost() { | 284 void TcpCubicSender::PrrOnPacketLost() { |
| 285 prr_out_ = 0; | 285 prr_out_ = 0; |
| 286 bytes_in_flight_before_loss_ = bytes_in_flight_; | 286 bytes_in_flight_before_loss_ = bytes_in_flight_; |
| 287 // Since all losses are triggered by an incoming ack currently, and acks are | 287 // Since all losses are triggered by an incoming ack currently, and acks are |
| (...skipping 28 matching lines...) Expand all Loading... |
| 316 // AvailableSendWindow = | 316 // AvailableSendWindow = |
| 317 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent | 317 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent |
| 318 if (prr_delivered_ * slowstart_threshold_ * kMaxSegmentSize > | 318 if (prr_delivered_ * slowstart_threshold_ * kMaxSegmentSize > |
| 319 prr_out_ * bytes_in_flight_before_loss_) { | 319 prr_out_ * bytes_in_flight_before_loss_) { |
| 320 return QuicTime::Delta::Zero(); | 320 return QuicTime::Delta::Zero(); |
| 321 } | 321 } |
| 322 return QuicTime::Delta::Infinite(); | 322 return QuicTime::Delta::Infinite(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace net | 325 } // namespace net |
| OLD | NEW |