OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_unacked_packet_map.h" | 5 #include "net/quic/quic_unacked_packet_map.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/quic_connection_stats.h" | 9 #include "net/quic/quic_connection_stats.h" |
10 #include "net/quic/quic_utils_chromium.h" | 10 #include "net/quic/quic_utils_chromium.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // We keep the old packet in the unacked packet list until it, or one of | 74 // We keep the old packet in the unacked packet list until it, or one of |
75 // the retransmissions of it are acked. | 75 // the retransmissions of it are acked. |
76 transmission_info->retransmittable_frames = NULL; | 76 transmission_info->retransmittable_frames = NULL; |
77 // Only keep one transmission older than largest observed, because only the | 77 // Only keep one transmission older than largest observed, because only the |
78 // most recent is expected to possibly be a spurious retransmission. | 78 // most recent is expected to possibly be a spurious retransmission. |
79 if (transmission_info->all_transmissions->size() > 1 && | 79 if (transmission_info->all_transmissions->size() > 1 && |
80 *(++transmission_info->all_transmissions->begin()) < largest_observed_) { | 80 *(++transmission_info->all_transmissions->begin()) < largest_observed_) { |
81 QuicPacketSequenceNumber old_transmission = | 81 QuicPacketSequenceNumber old_transmission = |
82 *transmission_info->all_transmissions->begin(); | 82 *transmission_info->all_transmissions->begin(); |
83 transmission_info->all_transmissions->erase(old_transmission); | 83 TransmissionInfo* old_transmission_info = |
84 unacked_packets_.erase(old_transmission); | 84 FindOrNull(unacked_packets_, old_transmission); |
| 85 // Don't remove old packets if they're still in flight. |
| 86 if (old_transmission_info == NULL || !old_transmission_info->in_flight) { |
| 87 transmission_info->all_transmissions->erase(old_transmission); |
| 88 unacked_packets_.erase(old_transmission); |
| 89 } |
85 } | 90 } |
86 unacked_packets_[new_sequence_number] = | 91 unacked_packets_[new_sequence_number] = |
87 TransmissionInfo(frames, | 92 TransmissionInfo(frames, |
88 new_sequence_number, | 93 new_sequence_number, |
89 transmission_info->sequence_number_length, | 94 transmission_info->sequence_number_length, |
90 transmission_type, | 95 transmission_type, |
91 transmission_info->all_transmissions); | 96 transmission_info->all_transmissions); |
92 } | 97 } |
93 | 98 |
94 void QuicUnackedPacketMap::ClearPreviousRetransmissions(size_t num_to_clear) { | 99 void QuicUnackedPacketMap::ClearPreviousRetransmissions(size_t num_to_clear) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 345 } |
341 DCHECK(!it->second.in_flight); | 346 DCHECK(!it->second.in_flight); |
342 DCHECK_NE(0u, it->second.bytes_sent); | 347 DCHECK_NE(0u, it->second.bytes_sent); |
343 DCHECK(it->second.sent_time.IsInitialized()); | 348 DCHECK(it->second.sent_time.IsInitialized()); |
344 | 349 |
345 bytes_in_flight_ += it->second.bytes_sent; | 350 bytes_in_flight_ += it->second.bytes_sent; |
346 it->second.in_flight = true; | 351 it->second.in_flight = true; |
347 } | 352 } |
348 | 353 |
349 } // namespace net | 354 } // namespace net |
OLD | NEW |