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

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

Issue 648933003: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with TOT Created 6 years, 2 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 | « net/quic/quic_protocol.h ('k') | net/quic/quic_received_packet_manager_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 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 <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 QuicAckFrame* ack_frame, QuicTime approximate_now) { 222 QuicAckFrame* ack_frame, QuicTime approximate_now) {
223 *ack_frame = ack_frame_; 223 *ack_frame = ack_frame_;
224 ack_frame->entropy_hash = EntropyHash(ack_frame_.largest_observed); 224 ack_frame->entropy_hash = EntropyHash(ack_frame_.largest_observed);
225 225
226 if (time_largest_observed_ == QuicTime::Zero()) { 226 if (time_largest_observed_ == QuicTime::Zero()) {
227 // We have received no packets. 227 // We have received no packets.
228 ack_frame->delta_time_largest_observed = QuicTime::Delta::Infinite(); 228 ack_frame->delta_time_largest_observed = QuicTime::Delta::Infinite();
229 return; 229 return;
230 } 230 }
231 231
232 if (approximate_now < time_largest_observed_) { 232 // Ensure the delta is zero if approximate now is "in the past".
233 // Approximate now may well be "in the past".
234 ack_frame->delta_time_largest_observed = QuicTime::Delta::Zero();
235 return;
236 }
237
238 ack_frame->delta_time_largest_observed = 233 ack_frame->delta_time_largest_observed =
239 approximate_now.Subtract(time_largest_observed_); 234 approximate_now < time_largest_observed_ ?
235 QuicTime::Delta::Zero() :
236 approximate_now.Subtract(time_largest_observed_);
240 237
241 // Remove all packets that are too far from largest_observed to express. 238 // Remove all packets that are too far from largest_observed to express.
242 received_packet_times_.remove_if(isTooLarge(ack_frame_.largest_observed)); 239 received_packet_times_.remove_if(isTooLarge(ack_frame_.largest_observed));
243 240
244 ack_frame->received_packet_times = received_packet_times_; 241 ack_frame->received_packet_times = received_packet_times_;
245 received_packet_times_.clear(); 242 received_packet_times_.clear();
246 } 243 }
247 244
248 bool QuicReceivedPacketManager::GenerateCongestionFeedback( 245 bool QuicReceivedPacketManager::GenerateCongestionFeedback(
249 QuicCongestionFeedbackFrame* feedback) { 246 QuicCongestionFeedbackFrame* feedback) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 peer_least_packet_awaiting_ack_); 284 peer_least_packet_awaiting_ack_);
288 } 285 }
289 286
290 bool QuicReceivedPacketManager::HasNewMissingPackets() { 287 bool QuicReceivedPacketManager::HasNewMissingPackets() {
291 return !ack_frame_.missing_packets.empty() && 288 return !ack_frame_.missing_packets.empty() &&
292 (ack_frame_.largest_observed - 289 (ack_frame_.largest_observed -
293 *ack_frame_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing; 290 *ack_frame_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing;
294 } 291 }
295 292
296 } // namespace net 293 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_received_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698