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

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

Issue 113123004: Change QUIC to only ack every other packet when there are no losses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 "net/base/linked_hash_map.h" 9 #include "net/base/linked_hash_map.h"
9 10
10 using std::make_pair; 11 using std::make_pair;
11 using std::max; 12 using std::max;
12 using std::min; 13 using std::min;
13 14
14 namespace net { 15 namespace net {
15 16
17 namespace {
18
19 // The maximum number of packets to ack immediately after a missing packet for
20 // fast retransmission to kick in at the sender. This limit is created to
21 // reduce the number of acks sent that have no benefit for fast retransmission.
22 // Set to the number of nacks needed for fast retransmit plus one for protection
23 // against an ack loss
24 const size_t kMaxPacketsAfterNewMissing = 4;
25
26 }
27
16 QuicReceivedPacketManager::QuicReceivedPacketManager( 28 QuicReceivedPacketManager::QuicReceivedPacketManager(
17 CongestionFeedbackType congestion_type) 29 CongestionFeedbackType congestion_type)
18 : packets_entropy_hash_(0), 30 : packets_entropy_hash_(0),
19 largest_sequence_number_(0), 31 largest_sequence_number_(0),
20 peer_largest_observed_packet_(0), 32 peer_largest_observed_packet_(0),
21 least_packet_awaited_by_peer_(1), 33 least_packet_awaited_by_peer_(1),
22 peer_least_packet_awaiting_ack_(0), 34 peer_least_packet_awaiting_ack_(0),
23 time_largest_observed_(QuicTime::Zero()), 35 time_largest_observed_(QuicTime::Zero()),
24 receive_algorithm_(ReceiveAlgorithmInterface::Create(congestion_type)) { 36 receive_algorithm_(ReceiveAlgorithmInterface::Create(congestion_type)) {
25 received_info_.largest_observed = 0; 37 received_info_.largest_observed = 0;
(...skipping 27 matching lines...) Expand all
53 } 65 }
54 RecordPacketEntropyHash(sequence_number, header.entropy_hash); 66 RecordPacketEntropyHash(sequence_number, header.entropy_hash);
55 67
56 // Don't update the receive algorithm for revived packets. 68 // Don't update the receive algorithm for revived packets.
57 if (!revived) { 69 if (!revived) {
58 receive_algorithm_->RecordIncomingPacket( 70 receive_algorithm_->RecordIncomingPacket(
59 bytes, sequence_number, receipt_time, revived); 71 bytes, sequence_number, receipt_time, revived);
60 } 72 }
61 } 73 }
62 74
75 bool QuicReceivedPacketManager::IsMissing(
76 QuicPacketSequenceNumber sequence_number) {
77 return ContainsKey(received_info_.missing_packets, sequence_number);
78 }
79
63 bool QuicReceivedPacketManager::IsAwaitingPacket( 80 bool QuicReceivedPacketManager::IsAwaitingPacket(
64 QuicPacketSequenceNumber sequence_number) { 81 QuicPacketSequenceNumber sequence_number) {
65 return ::net::IsAwaitingPacket(received_info_, sequence_number); 82 return ::net::IsAwaitingPacket(received_info_, sequence_number);
66 } 83 }
67 84
68 void QuicReceivedPacketManager::UpdateReceivedPacketInfo( 85 void QuicReceivedPacketManager::UpdateReceivedPacketInfo(
69 ReceivedPacketInfo* received_info, 86 ReceivedPacketInfo* received_info,
70 QuicTime approximate_now) { 87 QuicTime approximate_now) {
71 *received_info = received_info_; 88 *received_info = received_info_;
72 received_info->entropy_hash = EntropyHash(received_info_.largest_observed); 89 received_info->entropy_hash = EntropyHash(received_info_.largest_observed);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 223 }
207 DCHECK(received_info_.missing_packets.empty() || 224 DCHECK(received_info_.missing_packets.empty() ||
208 *received_info_.missing_packets.begin() >= 225 *received_info_.missing_packets.begin() >=
209 peer_least_packet_awaiting_ack_); 226 peer_least_packet_awaiting_ack_);
210 } 227 }
211 228
212 bool QuicReceivedPacketManager::HasMissingPackets() { 229 bool QuicReceivedPacketManager::HasMissingPackets() {
213 return !received_info_.missing_packets.empty(); 230 return !received_info_.missing_packets.empty();
214 } 231 }
215 232
233 bool QuicReceivedPacketManager::HasNewMissingPackets() {
234 return HasMissingPackets() &&
235 (received_info_.largest_observed -
236 *received_info_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing;
237 }
238
216 } // 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