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

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

Issue 564663005: Discard all useless QUIC retransmissions instead of only the most recent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_QUIC_CONNECTION_OVERALL_TIMED_OUT_75544619
Patch Set: Created 6 years, 3 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 == IS_HANDSHAKE) { 53 == IS_HANDSHAKE) {
54 ++pending_crypto_packet_count_; 54 ++pending_crypto_packet_count_;
55 } 55 }
56 } 56 }
57 57
58 void QuicUnackedPacketMap::RemoveObsoletePackets() { 58 void QuicUnackedPacketMap::RemoveObsoletePackets() {
59 while (!unacked_packets_.empty()) { 59 while (!unacked_packets_.empty()) {
60 if (!IsPacketRemovable(least_unacked_, unacked_packets_.front())) { 60 if (!IsPacketRemovable(least_unacked_, unacked_packets_.front())) {
61 break; 61 break;
62 } 62 }
63 delete unacked_packets_.front().all_transmissions;
64 unacked_packets_.pop_front(); 63 unacked_packets_.pop_front();
65 ++least_unacked_; 64 ++least_unacked_;
66 } 65 }
67 } 66 }
68 67
69 void QuicUnackedPacketMap::OnRetransmittedPacket( 68 void QuicUnackedPacketMap::OnRetransmittedPacket(
70 QuicPacketSequenceNumber old_sequence_number, 69 QuicPacketSequenceNumber old_sequence_number,
71 QuicPacketSequenceNumber new_sequence_number, 70 QuicPacketSequenceNumber new_sequence_number,
72 TransmissionType transmission_type) { 71 TransmissionType transmission_type) {
73 DCHECK_GE(old_sequence_number, least_unacked_); 72 DCHECK_GE(old_sequence_number, least_unacked_);
(...skipping 10 matching lines...) Expand all
84 RetransmittableFrames* frames = transmission_info->retransmittable_frames; 83 RetransmittableFrames* frames = transmission_info->retransmittable_frames;
85 LOG_IF(DFATAL, frames == NULL) << "Attempt to retransmit packet with no " 84 LOG_IF(DFATAL, frames == NULL) << "Attempt to retransmit packet with no "
86 << "retransmittable frames: " 85 << "retransmittable frames: "
87 << old_sequence_number; 86 << old_sequence_number;
88 87
89 // We keep the old packet in the unacked packet list until it, or one of 88 // We keep the old packet in the unacked packet list until it, or one of
90 // the retransmissions of it are acked. 89 // the retransmissions of it are acked.
91 transmission_info->retransmittable_frames = NULL; 90 transmission_info->retransmittable_frames = NULL;
92 // Only keep one transmission older than largest observed, because only the 91 // Only keep one transmission older than largest observed, because only the
93 // most recent is expected to possibly be a spurious retransmission. 92 // most recent is expected to possibly be a spurious retransmission.
94 if (transmission_info->all_transmissions != NULL && 93 while (transmission_info->all_transmissions != NULL &&
95 *(++transmission_info->all_transmissions->begin()) < largest_observed_) { 94 transmission_info->all_transmissions->size() > 1 &&
95 *(++transmission_info->all_transmissions->begin())
96 < largest_observed_) {
96 QuicPacketSequenceNumber old_transmission = 97 QuicPacketSequenceNumber old_transmission =
97 *transmission_info->all_transmissions->begin(); 98 *transmission_info->all_transmissions->begin();
98 TransmissionInfo* old_info = 99 TransmissionInfo* old_info =
99 &unacked_packets_[old_transmission - least_unacked_]; 100 &unacked_packets_[old_transmission - least_unacked_];
100 // Don't remove old packets if they're still in flight. 101 // Don't remove old packets if they're still in flight.
101 if (!old_info->in_flight) { 102 if (old_info->in_flight) {
102 old_info->all_transmissions->pop_front(); 103 break;
103 // This will cause the packet be removed in RemoveObsoletePackets.
104 old_info->all_transmissions = NULL;
105 } 104 }
105 old_info->all_transmissions->pop_front();
106 // This will cause the packet be removed in RemoveObsoletePackets.
107 old_info->all_transmissions = NULL;
106 } 108 }
107 // Don't link old transmissions to new ones when version or 109 // Don't link old transmissions to new ones when version or
108 // encryption changes. 110 // encryption changes.
109 if (transmission_type == ALL_INITIAL_RETRANSMISSION || 111 if (transmission_type == ALL_INITIAL_RETRANSMISSION ||
110 transmission_type == ALL_UNACKED_RETRANSMISSION) { 112 transmission_type == ALL_UNACKED_RETRANSMISSION) {
111 RemoveAckability(transmission_info); 113 RemoveAckability(transmission_info);
112 } else { 114 } else {
113 if (transmission_info->all_transmissions == NULL) { 115 if (transmission_info->all_transmissions == NULL) {
114 transmission_info->all_transmissions = new SequenceNumberList(); 116 transmission_info->all_transmissions = new SequenceNumberList();
115 transmission_info->all_transmissions->push_back(old_sequence_number); 117 transmission_info->all_transmissions->push_back(old_sequence_number);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; 385 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_];
384 DCHECK(!info->in_flight); 386 DCHECK(!info->in_flight);
385 DCHECK_NE(0u, info->bytes_sent); 387 DCHECK_NE(0u, info->bytes_sent);
386 DCHECK(info->sent_time.IsInitialized()); 388 DCHECK(info->sent_time.IsInitialized());
387 389
388 bytes_in_flight_ += info->bytes_sent; 390 bytes_in_flight_ += info->bytes_sent;
389 info->in_flight = true; 391 info->in_flight = true;
390 } 392 }
391 393
392 } // namespace net 394 } // 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