| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 const CongestionVector& acked_packets, | 118 const CongestionVector& acked_packets, |
| 119 const CongestionVector& lost_packets) { | 119 const CongestionVector& lost_packets) { |
| 120 if (rtt_updated && InSlowStart() && | 120 if (rtt_updated && InSlowStart() && |
| 121 hybrid_slow_start_.ShouldExitSlowStart( | 121 hybrid_slow_start_.ShouldExitSlowStart( |
| 122 rtt_stats_->latest_rtt(), rtt_stats_->min_rtt(), | 122 rtt_stats_->latest_rtt(), rtt_stats_->min_rtt(), |
| 123 GetCongestionWindow() / kDefaultTCPMSS)) { | 123 GetCongestionWindow() / kDefaultTCPMSS)) { |
| 124 ExitSlowstart(); | 124 ExitSlowstart(); |
| 125 } | 125 } |
| 126 for (CongestionVector::const_iterator it = lost_packets.begin(); | 126 for (CongestionVector::const_iterator it = lost_packets.begin(); |
| 127 it != lost_packets.end(); ++it) { | 127 it != lost_packets.end(); ++it) { |
| 128 OnPacketLost(it->first, bytes_in_flight); | 128 OnPacketLost(it->first, it->second, bytes_in_flight); |
| 129 } | 129 } |
| 130 for (CongestionVector::const_iterator it = acked_packets.begin(); | 130 for (CongestionVector::const_iterator it = acked_packets.begin(); |
| 131 it != acked_packets.end(); ++it) { | 131 it != acked_packets.end(); ++it) { |
| 132 OnPacketAcked(it->first, it->second, bytes_in_flight); | 132 OnPacketAcked(it->first, it->second, bytes_in_flight); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void TcpCubicSenderBase::OnPacketAcked(QuicPacketNumber acked_packet_number, | 136 void TcpCubicSenderBase::OnPacketAcked(QuicPacketNumber acked_packet_number, |
| 137 QuicByteCount acked_bytes, | 137 QuicByteCount acked_bytes, |
| 138 QuicByteCount bytes_in_flight) { | 138 QuicByteCount bytes_in_flight) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 168 prr_.OnPacketSent(bytes); | 168 prr_.OnPacketSent(bytes); |
| 169 } | 169 } |
| 170 DCHECK_LT(largest_sent_packet_number_, packet_number); | 170 DCHECK_LT(largest_sent_packet_number_, packet_number); |
| 171 largest_sent_packet_number_ = packet_number; | 171 largest_sent_packet_number_ = packet_number; |
| 172 hybrid_slow_start_.OnPacketSent(packet_number); | 172 hybrid_slow_start_.OnPacketSent(packet_number); |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 QuicTime::Delta TcpCubicSenderBase::TimeUntilSend( | 176 QuicTime::Delta TcpCubicSenderBase::TimeUntilSend( |
| 177 QuicTime /* now */, | 177 QuicTime /* now */, |
| 178 QuicByteCount bytes_in_flight, | 178 QuicByteCount bytes_in_flight) const { |
| 179 HasRetransmittableData has_retransmittable_data) const { | |
| 180 if (has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { | |
| 181 DCHECK(!FLAGS_quic_respect_send_alarm2); | |
| 182 // For TCP we can always send an ACK immediately. | |
| 183 return QuicTime::Delta::Zero(); | |
| 184 } | |
| 185 if (InRecovery()) { | 179 if (InRecovery()) { |
| 186 // PRR is used when in recovery. | 180 // PRR is used when in recovery. |
| 187 return prr_.TimeUntilSend(GetCongestionWindow(), bytes_in_flight, | 181 return prr_.TimeUntilSend(GetCongestionWindow(), bytes_in_flight, |
| 188 GetSlowStartThreshold()); | 182 GetSlowStartThreshold()); |
| 189 } | 183 } |
| 190 if (GetCongestionWindow() > bytes_in_flight) { | 184 if (GetCongestionWindow() > bytes_in_flight) { |
| 191 return QuicTime::Delta::Zero(); | 185 return QuicTime::Delta::Zero(); |
| 192 } | 186 } |
| 193 if (min4_mode_ && bytes_in_flight < 4 * kDefaultTCPMSS) { | 187 if (min4_mode_ && bytes_in_flight < 4 * kDefaultTCPMSS) { |
| 194 return QuicTime::Delta::Zero(); | 188 return QuicTime::Delta::Zero(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 void TcpCubicSenderBase::OnConnectionMigration() { | 252 void TcpCubicSenderBase::OnConnectionMigration() { |
| 259 hybrid_slow_start_.Restart(); | 253 hybrid_slow_start_.Restart(); |
| 260 prr_ = PrrSender(); | 254 prr_ = PrrSender(); |
| 261 largest_sent_packet_number_ = 0; | 255 largest_sent_packet_number_ = 0; |
| 262 largest_acked_packet_number_ = 0; | 256 largest_acked_packet_number_ = 0; |
| 263 largest_sent_at_last_cutback_ = 0; | 257 largest_sent_at_last_cutback_ = 0; |
| 264 last_cutback_exited_slowstart_ = false; | 258 last_cutback_exited_slowstart_ = false; |
| 265 } | 259 } |
| 266 | 260 |
| 267 } // namespace net | 261 } // namespace net |
| OLD | NEW |