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

Side by Side Diff: net/quic/congestion_control/tcp_loss_algorithm.cc

Issue 180723003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unintialized memory error 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
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/congestion_control/tcp_loss_algorithm.h"
6
7 #include "net/quic/quic_protocol.h"
8
9 namespace net {
10
11 namespace {
12 // TCP retransmits after 3 nacks.
13 static const size_t kNumberOfNacksBeforeRetransmission = 3;
14 }
15
16 TCPLossAlgorithm::TCPLossAlgorithm() { }
17
18 // Uses nack counts to decide when packets are lost.
19 SequenceNumberSet TCPLossAlgorithm::DetectLostPackets(
20 const QuicUnackedPacketMap& unacked_packets,
21 const QuicTime& time,
22 QuicPacketSequenceNumber largest_observed,
23 QuicTime::Delta srtt) {
24 SequenceNumberSet lost_packets;
25
26 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin();
27 it != unacked_packets.end() && it->first <= largest_observed; ++it) {
28 if (!it->second.pending) {
29 continue;
30 }
31 size_t num_nacks_needed = kNumberOfNacksBeforeRetransmission;
32 // Check for early retransmit(RFC5827) when the last packet gets acked and
33 // the there are fewer than 4 pending packets.
34 // TODO(ianswett): Set a retransmission timer instead of losing the packet
35 // and retransmitting immediately.
36 if (it->second.retransmittable_frames &&
37 unacked_packets.largest_sent_packet() == largest_observed) {
38 num_nacks_needed = largest_observed - it->first;
39 }
40
41 if (it->second.nack_count < num_nacks_needed) {
42 continue;
43 }
44
45 lost_packets.insert(it->first);
46 }
47
48 return lost_packets;
49 }
50
51 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_loss_algorithm.h ('k') | net/quic/congestion_control/tcp_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698