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

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

Issue 2001183002: Deprecate FLAGS_quic_simplify_loss_detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122429210
Patch Set: Created 4 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
« no previous file with comments | « no previous file | net/quic/congestion_control/general_loss_algorithm_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/general_loss_algorithm.h" 5 #include "net/quic/congestion_control/general_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_bug_tracker.h" 8 #include "net/quic/quic_bug_tracker.h"
9 #include "net/quic/quic_flags.h" 9 #include "net/quic/quic_flags.h"
10 #include "net/quic/quic_protocol.h" 10 #include "net/quic/quic_protocol.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 QuicTime::Delta::Max(QuicTime::Delta::FromMilliseconds(kMinLossDelayMs), 71 QuicTime::Delta::Max(QuicTime::Delta::FromMilliseconds(kMinLossDelayMs),
72 max_rtt.Multiply(1 + 1.0f / reordering_fraction_)); 72 max_rtt.Multiply(1 + 1.0f / reordering_fraction_));
73 QuicPacketNumber packet_number = unacked_packets.GetLeastUnacked(); 73 QuicPacketNumber packet_number = unacked_packets.GetLeastUnacked();
74 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin(); 74 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin();
75 it != unacked_packets.end() && packet_number <= largest_observed; 75 it != unacked_packets.end() && packet_number <= largest_observed;
76 ++it, ++packet_number) { 76 ++it, ++packet_number) {
77 if (!it->in_flight) { 77 if (!it->in_flight) {
78 continue; 78 continue;
79 } 79 }
80 80
81 if (FLAGS_quic_simplify_loss_detection && loss_type_ == kNack) { 81 if (loss_type_ == kNack) {
82 // FACK based loss detection. 82 // FACK based loss detection.
83 if (largest_observed - packet_number >= 83 if (largest_observed - packet_number >=
84 kNumberOfNacksBeforeRetransmission) { 84 kNumberOfNacksBeforeRetransmission) {
85 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent)); 85 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent));
86 continue; 86 continue;
87 } 87 }
88 } 88 }
89 89
90 // Only early retransmit(RFC5827) when the last packet gets acked and 90 // Only early retransmit(RFC5827) when the last packet gets acked and
91 // there are retransmittable packets in flight. 91 // there are retransmittable packets in flight.
92 // This also implements a timer-protected variant of FACK. 92 // This also implements a timer-protected variant of FACK.
93 if ((FLAGS_quic_simplify_loss_detection && 93 if ((!it->retransmittable_frames.empty() &&
94 !it->retransmittable_frames.empty() &&
95 unacked_packets.largest_sent_packet() == largest_observed) || 94 unacked_packets.largest_sent_packet() == largest_observed) ||
96 (loss_type_ == kTime || loss_type_ == kAdaptiveTime)) { 95 (loss_type_ == kTime || loss_type_ == kAdaptiveTime)) {
97 QuicTime when_lost = it->sent_time.Add(loss_delay); 96 QuicTime when_lost = it->sent_time.Add(loss_delay);
98 if (time < when_lost) { 97 if (time < when_lost) {
99 loss_detection_timeout_ = when_lost; 98 loss_detection_timeout_ = when_lost;
100 break; 99 break;
101 } 100 }
102 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent)); 101 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent));
103 continue; 102 continue;
104 } 103 }
105 if (!FLAGS_quic_simplify_loss_detection) {
106 // FACK based loss detection.
107 QUIC_BUG_IF(it->nack_count == 0 && it->sent_time.IsInitialized())
108 << "All packets less than largest observed should have been nacked."
109 << " packet_number:" << packet_number
110 << " largest_observed:" << largest_observed;
111 if (it->nack_count >= kNumberOfNacksBeforeRetransmission) {
112 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent));
113 continue;
114 }
115 }
116 104
117 // NACK-based loss detection allows for a max reordering window of 1 RTT. 105 // NACK-based loss detection allows for a max reordering window of 1 RTT.
118 if (it->sent_time.Add(rtt_stats.smoothed_rtt()) < 106 if (it->sent_time.Add(rtt_stats.smoothed_rtt()) <
119 unacked_packets.GetTransmissionInfo(largest_observed).sent_time) { 107 unacked_packets.GetTransmissionInfo(largest_observed).sent_time) {
120 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent)); 108 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent));
121 continue; 109 continue;
122 } 110 }
123
124 if (!FLAGS_quic_simplify_loss_detection &&
125 !it->retransmittable_frames.empty() &&
126 unacked_packets.largest_sent_packet() == largest_observed) {
127 // Early retransmit marks the packet as lost once 1.25RTTs have passed
128 // since the packet was sent and otherwise sets an alarm.
129 if (time >= it->sent_time.Add(loss_delay)) {
130 packets_lost->push_back(std::make_pair(packet_number, it->bytes_sent));
131 } else {
132 // Set the timeout for the earliest retransmittable packet where early
133 // retransmit applies.
134 loss_detection_timeout_ = it->sent_time.Add(loss_delay);
135 break;
136 }
137 }
138 } 111 }
139 } 112 }
140 113
141 QuicTime GeneralLossAlgorithm::GetLossTimeout() const { 114 QuicTime GeneralLossAlgorithm::GetLossTimeout() const {
142 return loss_detection_timeout_; 115 return loss_detection_timeout_;
143 } 116 }
144 117
145 void GeneralLossAlgorithm::SpuriousRetransmitDetected( 118 void GeneralLossAlgorithm::SpuriousRetransmitDetected(
146 const QuicUnackedPacketMap& unacked_packets, 119 const QuicUnackedPacketMap& unacked_packets,
147 QuicTime time, 120 QuicTime time,
(...skipping 15 matching lines...) Expand all
163 QuicTime::Delta max_rtt = 136 QuicTime::Delta max_rtt =
164 QuicTime::Delta::Max(rtt_stats.previous_srtt(), rtt_stats.latest_rtt()); 137 QuicTime::Delta::Max(rtt_stats.previous_srtt(), rtt_stats.latest_rtt());
165 QuicTime::Delta proposed_extra_time(QuicTime::Delta::Zero()); 138 QuicTime::Delta proposed_extra_time(QuicTime::Delta::Zero());
166 do { 139 do {
167 proposed_extra_time = max_rtt.Multiply(1.0f / reordering_fraction_); 140 proposed_extra_time = max_rtt.Multiply(1.0f / reordering_fraction_);
168 reordering_fraction_ >>= 1; 141 reordering_fraction_ >>= 1;
169 } while (proposed_extra_time < extra_time_needed && reordering_fraction_ > 1); 142 } while (proposed_extra_time < extra_time_needed && reordering_fraction_ > 1);
170 } 143 }
171 144
172 } // namespace net 145 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/congestion_control/general_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698