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

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

Issue 278823005: QUIC change to invoke SetNotPending for retransmissions in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_unacked_packet_map.h ('k') | no next file » | 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 it->second.nack_count = max(min_nacks, it->second.nack_count); 119 it->second.nack_count = max(min_nacks, it->second.nack_count);
120 } 120 }
121 121
122 void QuicUnackedPacketMap::RemovePacket( 122 void QuicUnackedPacketMap::RemovePacket(
123 QuicPacketSequenceNumber sequence_number) { 123 QuicPacketSequenceNumber sequence_number) {
124 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number); 124 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number);
125 if (it == unacked_packets_.end()) { 125 if (it == unacked_packets_.end()) {
126 LOG(DFATAL) << "packet is not unacked: " << sequence_number; 126 LOG(DFATAL) << "packet is not unacked: " << sequence_number;
127 return; 127 return;
128 } 128 }
129 const TransmissionInfo& transmission_info = it->second; 129 TransmissionInfo* transmission_info = &it->second;
130 transmission_info.all_transmissions->erase(sequence_number); 130 DCHECK(!transmission_info->pending);
131 if (transmission_info.all_transmissions->empty()) { 131 MaybeRemoveRetransmittableFrames(transmission_info);
132 delete transmission_info.all_transmissions; 132 transmission_info->all_transmissions->erase(sequence_number);
133 if (transmission_info->all_transmissions->empty()) {
134 delete transmission_info->all_transmissions;
133 } 135 }
134 if (transmission_info.retransmittable_frames != NULL) {
135 if (transmission_info.retransmittable_frames->HasCryptoHandshake()
136 == IS_HANDSHAKE) {
137 --pending_crypto_packet_count_;
138 }
139 delete transmission_info.retransmittable_frames;
140 }
141 DCHECK(!transmission_info.pending);
142 unacked_packets_.erase(it); 136 unacked_packets_.erase(it);
143 } 137 }
144 138
145 void QuicUnackedPacketMap::NeuterPacket( 139 void QuicUnackedPacketMap::NeuterPacket(
146 QuicPacketSequenceNumber sequence_number) { 140 QuicPacketSequenceNumber sequence_number) {
147 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number); 141 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number);
148 if (it == unacked_packets_.end()) { 142 if (it == unacked_packets_.end()) {
149 LOG(DFATAL) << "packet is not unacked: " << sequence_number; 143 LOG(DFATAL) << "packet is not unacked: " << sequence_number;
150 return; 144 return;
151 } 145 }
152 TransmissionInfo* transmission_info = &it->second; 146 TransmissionInfo* transmission_info = &it->second;
147 // TODO(ianswett): Ensure packets are pending before neutering them.
148 MaybeRemoveRetransmittableFrames(transmission_info);
153 if (transmission_info->all_transmissions->size() > 1) { 149 if (transmission_info->all_transmissions->size() > 1) {
154 transmission_info->all_transmissions->erase(sequence_number); 150 transmission_info->all_transmissions->erase(sequence_number);
155 transmission_info->all_transmissions = new SequenceNumberSet(); 151 transmission_info->all_transmissions = new SequenceNumberSet();
156 transmission_info->all_transmissions->insert(sequence_number); 152 transmission_info->all_transmissions->insert(sequence_number);
157 } 153 }
154 }
155
156 void QuicUnackedPacketMap::MaybeRemoveRetransmittableFrames(
157 TransmissionInfo* transmission_info) {
158 if (transmission_info->retransmittable_frames != NULL) { 158 if (transmission_info->retransmittable_frames != NULL) {
159 if (transmission_info->retransmittable_frames->HasCryptoHandshake() 159 if (transmission_info->retransmittable_frames->HasCryptoHandshake()
160 == IS_HANDSHAKE) { 160 == IS_HANDSHAKE) {
161 --pending_crypto_packet_count_; 161 --pending_crypto_packet_count_;
162 } 162 }
163 delete transmission_info->retransmittable_frames; 163 delete transmission_info->retransmittable_frames;
164 transmission_info->retransmittable_frames = NULL; 164 transmission_info->retransmittable_frames = NULL;
165 } 165 }
166 } 166 }
167 167
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 largest_sent_packet_ = max(sequence_number, largest_sent_packet_); 308 largest_sent_packet_ = max(sequence_number, largest_sent_packet_);
309 it->second.sent_time = sent_time; 309 it->second.sent_time = sent_time;
310 if (set_pending) { 310 if (set_pending) {
311 bytes_in_flight_ += bytes_sent; 311 bytes_in_flight_ += bytes_sent;
312 it->second.bytes_sent = bytes_sent; 312 it->second.bytes_sent = bytes_sent;
313 it->second.pending = true; 313 it->second.pending = true;
314 } 314 }
315 } 315 }
316 316
317 } // namespace net 317 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_unacked_packet_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698