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

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

Issue 157803006: Change the types of the arguments to two methods in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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_received_packet_manager.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_received_packet_manager.h" 5 #include "net/quic/quic_received_packet_manager.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/base/linked_hash_map.h" 9 #include "net/base/linked_hash_map.h"
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 packets_entropy_hash_ ^= it->second; 175 packets_entropy_hash_ ^= it->second;
176 } 176 }
177 // Discard entropies before least unacked. 177 // Discard entropies before least unacked.
178 packets_entropy_.erase( 178 packets_entropy_.erase(
179 packets_entropy_.begin(), 179 packets_entropy_.begin(),
180 packets_entropy_.lower_bound( 180 packets_entropy_.lower_bound(
181 min(peer_least_unacked, received_info_.largest_observed))); 181 min(peer_least_unacked, received_info_.largest_observed)));
182 } 182 }
183 183
184 void QuicReceivedPacketManager::UpdatePacketInformationReceivedByPeer( 184 void QuicReceivedPacketManager::UpdatePacketInformationReceivedByPeer(
185 const QuicAckFrame& incoming_ack) { 185 const ReceivedPacketInfo& received_info) {
186 // ValidateAck should fail if largest_observed ever shrinks. 186 // ValidateAck should fail if largest_observed ever shrinks.
187 DCHECK_LE(peer_largest_observed_packet_, 187 DCHECK_LE(peer_largest_observed_packet_, received_info.largest_observed);
188 incoming_ack.received_info.largest_observed); 188 peer_largest_observed_packet_ = received_info.largest_observed;
189 peer_largest_observed_packet_ = incoming_ack.received_info.largest_observed;
190 189
191 if (incoming_ack.received_info.missing_packets.empty()) { 190 if (received_info.missing_packets.empty()) {
192 least_packet_awaited_by_peer_ = peer_largest_observed_packet_ + 1; 191 least_packet_awaited_by_peer_ = peer_largest_observed_packet_ + 1;
193 } else { 192 } else {
194 least_packet_awaited_by_peer_ = 193 least_packet_awaited_by_peer_ = *(received_info.missing_packets.begin());
195 *(incoming_ack.received_info.missing_packets.begin());
196 } 194 }
197 } 195 }
198 196
199 bool QuicReceivedPacketManager::DontWaitForPacketsBefore( 197 bool QuicReceivedPacketManager::DontWaitForPacketsBefore(
200 QuicPacketSequenceNumber least_unacked) { 198 QuicPacketSequenceNumber least_unacked) {
201 received_info_.revived_packets.erase( 199 received_info_.revived_packets.erase(
202 received_info_.revived_packets.begin(), 200 received_info_.revived_packets.begin(),
203 received_info_.revived_packets.lower_bound(least_unacked)); 201 received_info_.revived_packets.lower_bound(least_unacked));
204 size_t missing_packets_count = received_info_.missing_packets.size(); 202 size_t missing_packets_count = received_info_.missing_packets.size();
205 received_info_.missing_packets.erase( 203 received_info_.missing_packets.erase(
206 received_info_.missing_packets.begin(), 204 received_info_.missing_packets.begin(),
207 received_info_.missing_packets.lower_bound(least_unacked)); 205 received_info_.missing_packets.lower_bound(least_unacked));
208 return missing_packets_count != received_info_.missing_packets.size(); 206 return missing_packets_count != received_info_.missing_packets.size();
209 } 207 }
210 208
211 void QuicReceivedPacketManager::UpdatePacketInformationSentByPeer( 209 void QuicReceivedPacketManager::UpdatePacketInformationSentByPeer(
212 const QuicAckFrame& incoming_ack) { 210 const SentPacketInfo& sent_info) {
213 // ValidateAck() should fail if peer_least_packet_awaiting_ack_ shrinks. 211 // ValidateAck() should fail if peer_least_packet_awaiting_ack_ shrinks.
214 DCHECK_LE(peer_least_packet_awaiting_ack_, 212 DCHECK_LE(peer_least_packet_awaiting_ack_, sent_info.least_unacked);
215 incoming_ack.sent_info.least_unacked); 213 if (sent_info.least_unacked > peer_least_packet_awaiting_ack_) {
216 if (incoming_ack.sent_info.least_unacked > peer_least_packet_awaiting_ack_) { 214 bool missed_packets = DontWaitForPacketsBefore(sent_info.least_unacked);
217 bool missed_packets = 215 if (missed_packets || sent_info.least_unacked >
218 DontWaitForPacketsBefore(incoming_ack.sent_info.least_unacked);
219 if (missed_packets || incoming_ack.sent_info.least_unacked >
220 received_info_.largest_observed + 1) { 216 received_info_.largest_observed + 1) {
221 DVLOG(1) << "Updating entropy hashed since we missed packets"; 217 DVLOG(1) << "Updating entropy hashed since we missed packets";
222 // There were some missing packets that we won't ever get now. Recalculate 218 // There were some missing packets that we won't ever get now. Recalculate
223 // the received entropy hash. 219 // the received entropy hash.
224 RecalculateEntropyHash(incoming_ack.sent_info.least_unacked, 220 RecalculateEntropyHash(sent_info.least_unacked, sent_info.entropy_hash);
225 incoming_ack.sent_info.entropy_hash);
226 } 221 }
227 peer_least_packet_awaiting_ack_ = incoming_ack.sent_info.least_unacked; 222 peer_least_packet_awaiting_ack_ = sent_info.least_unacked;
228 } 223 }
229 DCHECK(received_info_.missing_packets.empty() || 224 DCHECK(received_info_.missing_packets.empty() ||
230 *received_info_.missing_packets.begin() >= 225 *received_info_.missing_packets.begin() >=
231 peer_least_packet_awaiting_ack_); 226 peer_least_packet_awaiting_ack_);
232 } 227 }
233 228
234 bool QuicReceivedPacketManager::HasMissingPackets() { 229 bool QuicReceivedPacketManager::HasMissingPackets() {
235 return !received_info_.missing_packets.empty(); 230 return !received_info_.missing_packets.empty();
236 } 231 }
237 232
238 bool QuicReceivedPacketManager::HasNewMissingPackets() { 233 bool QuicReceivedPacketManager::HasNewMissingPackets() {
239 return HasMissingPackets() && 234 return HasMissingPackets() &&
240 (received_info_.largest_observed - 235 (received_info_.largest_observed -
241 *received_info_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing; 236 *received_info_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing;
242 } 237 }
243 238
244 } // namespace net 239 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_received_packet_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698