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

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

Issue 266243004: Clang format slam. 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
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/congestion_control/tcp_loss_algorithm.h" 5 #include "net/quic/congestion_control/tcp_loss_algorithm.h"
6 6
7 #include "net/quic/congestion_control/rtt_stats.h" 7 #include "net/quic/congestion_control/rtt_stats.h"
8 #include "net/quic/quic_protocol.h" 8 #include "net/quic/quic_protocol.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace { 12 namespace {
13 13
14 // TCP retransmits after 3 nacks. 14 // TCP retransmits after 3 nacks.
15 static const size_t kNumberOfNacksBeforeRetransmission = 3; 15 static const size_t kNumberOfNacksBeforeRetransmission = 3;
16 16
17 // How many RTTs the algorithm waits before determining a packet is lost due 17 // How many RTTs the algorithm waits before determining a packet is lost due
18 // to early retransmission. 18 // to early retransmission.
19 static const double kEarlyRetransmitLossDelayMultiplier = 1.25; 19 static const double kEarlyRetransmitLossDelayMultiplier = 1.25;
20
21 } 20 }
22 21
23 TCPLossAlgorithm::TCPLossAlgorithm() 22 TCPLossAlgorithm::TCPLossAlgorithm()
24 : loss_detection_timeout_(QuicTime::Zero()) { } 23 : loss_detection_timeout_(QuicTime::Zero()) {
24 }
25 25
26 LossDetectionType TCPLossAlgorithm::GetLossDetectionType() const { 26 LossDetectionType TCPLossAlgorithm::GetLossDetectionType() const {
27 return kNack; 27 return kNack;
28 } 28 }
29 29
30 // Uses nack counts to decide when packets are lost. 30 // Uses nack counts to decide when packets are lost.
31 SequenceNumberSet TCPLossAlgorithm::DetectLostPackets( 31 SequenceNumberSet TCPLossAlgorithm::DetectLostPackets(
32 const QuicUnackedPacketMap& unacked_packets, 32 const QuicUnackedPacketMap& unacked_packets,
33 const QuicTime& time, 33 const QuicTime& time,
34 QuicPacketSequenceNumber largest_observed, 34 QuicPacketSequenceNumber largest_observed,
35 const RttStats& rtt_stats) { 35 const RttStats& rtt_stats) {
36 SequenceNumberSet lost_packets; 36 SequenceNumberSet lost_packets;
37 loss_detection_timeout_ = QuicTime::Zero(); 37 loss_detection_timeout_ = QuicTime::Zero();
38 QuicTime::Delta loss_delay = 38 QuicTime::Delta loss_delay =
39 rtt_stats.SmoothedRtt().Multiply(kEarlyRetransmitLossDelayMultiplier); 39 rtt_stats.SmoothedRtt().Multiply(kEarlyRetransmitLossDelayMultiplier);
40 40
41 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin(); 41 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin();
42 it != unacked_packets.end() && it->first <= largest_observed; ++it) { 42 it != unacked_packets.end() && it->first <= largest_observed;
43 ++it) {
43 if (!it->second.pending) { 44 if (!it->second.pending) {
44 continue; 45 continue;
45 } 46 }
46 47
47 LOG_IF(DFATAL, it->second.nack_count == 0) 48 LOG_IF(DFATAL, it->second.nack_count == 0)
48 << "All packets less than largest observed should have been nacked."; 49 << "All packets less than largest observed should have been nacked.";
49 if (it->second.nack_count >= kNumberOfNacksBeforeRetransmission) { 50 if (it->second.nack_count >= kNumberOfNacksBeforeRetransmission) {
50 lost_packets.insert(it->first); 51 lost_packets.insert(it->first);
51 continue; 52 continue;
52 } 53 }
(...skipping 17 matching lines...) Expand all
70 } 71 }
71 72
72 return lost_packets; 73 return lost_packets;
73 } 74 }
74 75
75 QuicTime TCPLossAlgorithm::GetLossTimeout() const { 76 QuicTime TCPLossAlgorithm::GetLossTimeout() const {
76 return loss_detection_timeout_; 77 return loss_detection_timeout_;
77 } 78 }
78 79
79 } // namespace net 80 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698