OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 // A notifier may be waiting to hear about ACKs for the original sequence | 150 // A notifier may be waiting to hear about ACKs for the original sequence |
151 // number. Inform them that the sequence number has changed. | 151 // number. Inform them that the sequence number has changed. |
152 ack_notifier_manager_.UpdateSequenceNumber(old_sequence_number, | 152 ack_notifier_manager_.UpdateSequenceNumber(old_sequence_number, |
153 new_sequence_number); | 153 new_sequence_number); |
154 | 154 |
155 unacked_packets_.OnRetransmittedPacket(old_sequence_number, | 155 unacked_packets_.OnRetransmittedPacket(old_sequence_number, |
156 new_sequence_number, | 156 new_sequence_number, |
157 transmission_type); | 157 transmission_type); |
| 158 |
| 159 if (debug_delegate_ != NULL) { |
| 160 debug_delegate_->OnRetransmittedPacket(old_sequence_number, |
| 161 new_sequence_number, |
| 162 transmission_type, |
| 163 clock_->ApproximateNow()); |
| 164 } |
158 } | 165 } |
159 | 166 |
160 void QuicSentPacketManager::OnIncomingAck( | 167 void QuicSentPacketManager::OnIncomingAck( |
161 const ReceivedPacketInfo& received_info, | 168 const ReceivedPacketInfo& received_info, |
162 QuicTime ack_receive_time) { | 169 QuicTime ack_receive_time) { |
163 QuicByteCount bytes_in_flight = unacked_packets_.bytes_in_flight(); | 170 QuicByteCount bytes_in_flight = unacked_packets_.bytes_in_flight(); |
164 | 171 |
165 // We rely on delta_time_largest_observed to compute an RTT estimate, so | 172 // We rely on delta_time_largest_observed to compute an RTT estimate, so |
166 // we only update rtt when the largest observed gets acked. | 173 // we only update rtt when the largest observed gets acked. |
167 bool largest_observed_acked = MaybeUpdateRTT(received_info, ack_receive_time); | 174 bool largest_observed_acked = MaybeUpdateRTT(received_info, ack_receive_time); |
(...skipping 13 matching lines...) Expand all Loading... |
181 } | 188 } |
182 | 189 |
183 // Anytime we are making forward progress and have a new RTT estimate, reset | 190 // Anytime we are making forward progress and have a new RTT estimate, reset |
184 // the backoff counters. | 191 // the backoff counters. |
185 if (largest_observed_acked) { | 192 if (largest_observed_acked) { |
186 // Reset all retransmit counters any time a new packet is acked. | 193 // Reset all retransmit counters any time a new packet is acked. |
187 consecutive_rto_count_ = 0; | 194 consecutive_rto_count_ = 0; |
188 consecutive_tlp_count_ = 0; | 195 consecutive_tlp_count_ = 0; |
189 consecutive_crypto_retransmission_count_ = 0; | 196 consecutive_crypto_retransmission_count_ = 0; |
190 } | 197 } |
| 198 |
| 199 if (debug_delegate_ != NULL) { |
| 200 debug_delegate_->OnIncomingAck(received_info, |
| 201 ack_receive_time, |
| 202 largest_observed_, |
| 203 largest_observed_acked, |
| 204 GetLeastUnackedSentPacket()); |
| 205 } |
191 } | 206 } |
192 | 207 |
193 void QuicSentPacketManager::MaybeInvokeCongestionEvent( | 208 void QuicSentPacketManager::MaybeInvokeCongestionEvent( |
194 bool rtt_updated, QuicByteCount bytes_in_flight) { | 209 bool rtt_updated, QuicByteCount bytes_in_flight) { |
195 if (rtt_updated || !packets_acked_.empty() || | 210 if (rtt_updated || !packets_acked_.empty() || |
196 !packets_lost_.empty()) { | 211 !packets_lost_.empty()) { |
197 send_algorithm_->OnCongestionEvent( | 212 send_algorithm_->OnCongestionEvent( |
198 rtt_updated, bytes_in_flight, packets_acked_, packets_lost_); | 213 rtt_updated, bytes_in_flight, packets_acked_, packets_lost_); |
199 packets_acked_.clear(); | 214 packets_acked_.clear(); |
200 packets_lost_.clear(); | 215 packets_lost_.clear(); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 506 |
492 // Only track packets as in flight that the send algorithm wants us to track. | 507 // Only track packets as in flight that the send algorithm wants us to track. |
493 const bool in_flight = | 508 const bool in_flight = |
494 send_algorithm_->OnPacketSent(sent_time, | 509 send_algorithm_->OnPacketSent(sent_time, |
495 unacked_packets_.bytes_in_flight(), | 510 unacked_packets_.bytes_in_flight(), |
496 sequence_number, | 511 sequence_number, |
497 bytes, | 512 bytes, |
498 has_retransmittable_data); | 513 has_retransmittable_data); |
499 unacked_packets_.SetSent(sequence_number, sent_time, bytes, in_flight); | 514 unacked_packets_.SetSent(sequence_number, sent_time, bytes, in_flight); |
500 | 515 |
| 516 if (debug_delegate_ != NULL) { |
| 517 debug_delegate_->OnSentPacket(sequence_number, sent_time, bytes); |
| 518 } |
| 519 |
501 // Reset the retransmission timer anytime a pending packet is sent. | 520 // Reset the retransmission timer anytime a pending packet is sent. |
502 return in_flight; | 521 return in_flight; |
503 } | 522 } |
504 | 523 |
505 void QuicSentPacketManager::OnRetransmissionTimeout() { | 524 void QuicSentPacketManager::OnRetransmissionTimeout() { |
506 DCHECK(unacked_packets_.HasInFlightPackets()); | 525 DCHECK(unacked_packets_.HasInFlightPackets()); |
507 DCHECK(!pending_tlp_transmission_); | 526 DCHECK(!pending_tlp_transmission_); |
508 // Handshake retransmission, timer based loss detection, TLP, and RTO are | 527 // Handshake retransmission, timer based loss detection, TLP, and RTO are |
509 // implemented with a single alarm. The handshake alarm is set when the | 528 // implemented with a single alarm. The handshake alarm is set when the |
510 // handshake has not completed, the loss alarm is set when the loss detection | 529 // handshake has not completed, the loss alarm is set when the loss detection |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 | 843 |
825 // Set up a pacing sender with a 5 millisecond alarm granularity. | 844 // Set up a pacing sender with a 5 millisecond alarm granularity. |
826 using_pacing_ = true; | 845 using_pacing_ = true; |
827 send_algorithm_.reset( | 846 send_algorithm_.reset( |
828 new PacingSender(send_algorithm_.release(), | 847 new PacingSender(send_algorithm_.release(), |
829 QuicTime::Delta::FromMilliseconds(5), | 848 QuicTime::Delta::FromMilliseconds(5), |
830 kInitialUnpacedBurst)); | 849 kInitialUnpacedBurst)); |
831 } | 850 } |
832 | 851 |
833 } // namespace net | 852 } // namespace net |
OLD | NEW |