Index: net/quic/quic_sent_packet_manager.cc |
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc |
index c18b456b26ec63558d7ae6550ccc9ed274d0729b..c592e133a2c99892ae72119de8fe85efd0185618 100644 |
--- a/net/quic/quic_sent_packet_manager.cc |
+++ b/net/quic/quic_sent_packet_manager.cc |
@@ -358,7 +358,7 @@ void QuicSentPacketManager::MarkForRetransmission( |
} |
void QuicSentPacketManager::RecordSpuriousRetransmissions( |
- const SequenceNumberSet& all_transmissions, |
+ const SequenceNumberList& all_transmissions, |
QuicPacketSequenceNumber acked_sequence_number) { |
if (acked_sequence_number < first_rto_transmission_) { |
// Cancel all pending RTO transmissions and restore their in flight status. |
@@ -376,11 +376,9 @@ void QuicSentPacketManager::RecordSpuriousRetransmissions( |
first_rto_transmission_ = 0; |
++stats_->spurious_rto_count; |
} |
- for (SequenceNumberSet::const_iterator |
- it = all_transmissions.upper_bound(acked_sequence_number), |
- end = all_transmissions.end(); |
- it != end; |
- ++it) { |
+ for (SequenceNumberList::const_reverse_iterator it = |
+ all_transmissions.rbegin(); |
+ it != all_transmissions.rend() && *it > acked_sequence_number; ++it) { |
const TransmissionInfo& retransmit_info = |
unacked_packets_.GetTransmissionInfo(*it); |
@@ -438,7 +436,8 @@ void QuicSentPacketManager::MarkPacketRevived( |
const TransmissionInfo& transmission_info = |
unacked_packets_.GetTransmissionInfo(sequence_number); |
QuicPacketSequenceNumber newest_transmission = |
- *transmission_info.all_transmissions->rbegin(); |
+ transmission_info.all_transmissions == NULL ? |
+ sequence_number : *transmission_info.all_transmissions->rbegin(); |
// This packet has been revived at the receiver. If we were going to |
// retransmit it, do not retransmit it anymore. |
pending_retransmissions_.erase(newest_transmission); |
@@ -458,34 +457,29 @@ void QuicSentPacketManager::MarkPacketHandled( |
const TransmissionInfo& info, |
QuicTime::Delta delta_largest_observed) { |
QuicPacketSequenceNumber newest_transmission = |
- *info.all_transmissions->rbegin(); |
+ info.all_transmissions == NULL ? |
+ sequence_number : *info.all_transmissions->rbegin(); |
// Remove the most recent packet, if it is pending retransmission. |
pending_retransmissions_.erase(newest_transmission); |
- // Notify observers about the ACKed packet. |
- { |
- // The AckNotifierManager needs to be notified about the most recent |
- // transmission, since that's the one only one it tracks. |
- ack_notifier_manager_.OnPacketAcked(newest_transmission, |
- delta_largest_observed); |
- if (newest_transmission != sequence_number) { |
- RecordSpuriousRetransmissions(*info.all_transmissions, sequence_number); |
+ // The AckNotifierManager needs to be notified about the most recent |
+ // transmission, since that's the one only one it tracks. |
+ ack_notifier_manager_.OnPacketAcked(newest_transmission, |
+ delta_largest_observed); |
+ if (newest_transmission != sequence_number) { |
+ RecordSpuriousRetransmissions(*info.all_transmissions, sequence_number); |
+ // Remove the most recent packet from flight if it's a crypto handshake |
+ // packet, since they won't be acked now that one has been processed. |
+ // Other crypto handshake packets won't be in flight, only the newest |
+ // transmission of a crypto packet is in flight at once. |
+ // TODO(ianswett): Instead of handling all crypto packets special, |
+ // only handle NULL encrypted packets in a special way. |
+ if (HasCryptoHandshake( |
+ unacked_packets_.GetTransmissionInfo(newest_transmission))) { |
+ unacked_packets_.RemoveFromInFlight(newest_transmission); |
} |
} |
- // Two cases for MarkPacketHandled: |
- // 1) Handle the most recent or a crypto packet, so remove all transmissions. |
- // 2) Handle old transmission, keep all other pending transmissions, |
- // but disassociate them from one another. |
- |
- // If it's a crypto handshake packet, discard it and all retransmissions, |
- // since they won't be acked now that one has been processed. |
- // TODO(ianswett): Instead of handling all crypto packets in a special way, |
- // only handle NULL encrypted packets in a special way. |
- if (HasCryptoHandshake( |
- unacked_packets_.GetTransmissionInfo(newest_transmission))) { |
- unacked_packets_.RemoveFromInFlight(newest_transmission); |
- } |
unacked_packets_.RemoveFromInFlight(sequence_number); |
unacked_packets_.RemoveRetransmittability(sequence_number); |
} |