| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "net/quic/congestion_control/pacing_sender.h" | 9 #include "net/quic/congestion_control/pacing_sender.h" |
| 10 #include "net/quic/quic_ack_notifier_manager.h" | 10 #include "net/quic/quic_ack_notifier_manager.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 previous_transmissions->insert(new_sequence_number); | 175 previous_transmissions->insert(new_sequence_number); |
| 176 unacked_packets_[new_sequence_number].previous_transmissions = | 176 unacked_packets_[new_sequence_number].previous_transmissions = |
| 177 previous_transmissions; | 177 previous_transmissions; |
| 178 | 178 |
| 179 DCHECK(HasRetransmittableFrames(new_sequence_number)); | 179 DCHECK(HasRetransmittableFrames(new_sequence_number)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool QuicSentPacketManager::OnIncomingAck( | 182 bool QuicSentPacketManager::OnIncomingAck( |
| 183 const ReceivedPacketInfo& received_info, QuicTime ack_receive_time) { | 183 const ReceivedPacketInfo& received_info, QuicTime ack_receive_time) { |
| 184 // Determine if the least unacked sequence number is being acked. | 184 // We rely on delta_time_largest_observed to compute an RTT estimate, so |
| 185 QuicPacketSequenceNumber least_unacked_sent_before = | 185 // we only update rtt when the largest observed gets acked. |
| 186 GetLeastUnackedSentPacket(); | 186 bool largest_observed_acked = |
| 187 // TODO(ianswett): Consider a non-TCP metric for determining the connection | 187 ContainsKey(unacked_packets_, received_info.largest_observed); |
| 188 // is making progress, since QUIC has out of order delivery. | |
| 189 bool new_least_unacked = !IsAwaitingPacket(received_info, | |
| 190 least_unacked_sent_before); | |
| 191 | |
| 192 MaybeUpdateRTT(received_info, ack_receive_time); | 188 MaybeUpdateRTT(received_info, ack_receive_time); |
| 193 HandleAckForSentPackets(received_info); | 189 HandleAckForSentPackets(received_info); |
| 194 MaybeRetransmitOnAckFrame(received_info, ack_receive_time); | 190 MaybeRetransmitOnAckFrame(received_info, ack_receive_time); |
| 195 | 191 |
| 196 if (new_least_unacked) { | 192 // Anytime we are making forward progress and have a new RTT estimate, reset |
| 193 // the backoff counters. |
| 194 if (largest_observed_acked) { |
| 197 // Reset all retransmit counters any time a new packet is acked. | 195 // Reset all retransmit counters any time a new packet is acked. |
| 198 consecutive_rto_count_ = 0; | 196 consecutive_rto_count_ = 0; |
| 199 consecutive_tlp_count_ = 0; | 197 consecutive_tlp_count_ = 0; |
| 200 consecutive_crypto_retransmission_count_ = 0; | 198 consecutive_crypto_retransmission_count_ = 0; |
| 201 } | 199 } |
| 202 | 200 |
| 203 // Always reset the retransmission alarm when an ack comes in, since we now | 201 // Always reset the retransmission alarm when an ack comes in, since we now |
| 204 // have a better estimate of the current rtt than when it was set. | 202 // have a better estimate of the current rtt than when it was set. |
| 205 return true; | 203 return true; |
| 206 } | 204 } |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 } | 995 } |
| 998 previous_transmissions->erase(sequence_number); | 996 previous_transmissions->erase(sequence_number); |
| 999 if (previous_transmissions->size() == 1) { | 997 if (previous_transmissions->size() == 1) { |
| 1000 QuicPacketSequenceNumber current = *previous_transmissions->begin(); | 998 QuicPacketSequenceNumber current = *previous_transmissions->begin(); |
| 1001 unacked_packets_[current].previous_transmissions = NULL; | 999 unacked_packets_[current].previous_transmissions = NULL; |
| 1002 delete previous_transmissions; | 1000 delete previous_transmissions; |
| 1003 } | 1001 } |
| 1004 } | 1002 } |
| 1005 | 1003 |
| 1006 } // namespace net | 1004 } // namespace net |
| OLD | NEW |