Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: net/quic/quic_unacked_packet_map.cc

Issue 422123005: Fix a bug in QuicUnackedPacketMap where an in flight packet could be (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Inline_ReceivedPacketInfo_71763611
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/quic_unacked_packet_map_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_unacked_packet_map_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698