OLD | NEW |
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/core/quic_sent_packet_manager.h" | 5 #include "net/quic/core/quic_sent_packet_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 max(kMinInitialRoundTripTimeUs, | 104 max(kMinInitialRoundTripTimeUs, |
105 min(kMaxInitialRoundTripTimeUs, | 105 min(kMaxInitialRoundTripTimeUs, |
106 config.ReceivedInitialRoundTripTimeUs()))); | 106 config.ReceivedInitialRoundTripTimeUs()))); |
107 } else if (config.HasInitialRoundTripTimeUsToSend() && | 107 } else if (config.HasInitialRoundTripTimeUsToSend() && |
108 config.GetInitialRoundTripTimeUsToSend() > 0) { | 108 config.GetInitialRoundTripTimeUsToSend() > 0) { |
109 rtt_stats_.set_initial_rtt_us( | 109 rtt_stats_.set_initial_rtt_us( |
110 max(kMinInitialRoundTripTimeUs, | 110 max(kMinInitialRoundTripTimeUs, |
111 min(kMaxInitialRoundTripTimeUs, | 111 min(kMaxInitialRoundTripTimeUs, |
112 config.GetInitialRoundTripTimeUsToSend()))); | 112 config.GetInitialRoundTripTimeUsToSend()))); |
113 } | 113 } |
114 if (FLAGS_quic_allow_new_bbr && config.HasReceivedConnectionOptions() && | 114 // Configure congestion control. |
115 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { | 115 const bool enable_client_connection_options = |
116 SetSendAlgorithm(kBBR); | 116 FLAGS_quic_client_connection_options; |
117 } | 117 if (enable_client_connection_options) { |
118 if (config.HasReceivedConnectionOptions() && | 118 if (FLAGS_quic_allow_new_bbr && |
119 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { | 119 config.HasClientRequestedIndependentOption(kTBBR, perspective_)) { |
120 if (ContainsQuicTag(config.ReceivedConnectionOptions(), kBYTE)) { | 120 SetSendAlgorithm(kBBR); |
121 SetSendAlgorithm(kRenoBytes); | |
122 } else { | |
123 SetSendAlgorithm(kReno); | |
124 } | 121 } |
125 } else if (config.HasReceivedConnectionOptions() && | 122 if (config.HasClientRequestedIndependentOption(kRENO, perspective_)) { |
126 ContainsQuicTag(config.ReceivedConnectionOptions(), kBYTE)) { | 123 if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { |
127 if (FLAGS_quic_default_enable_cubic_bytes) { | 124 SetSendAlgorithm(kRenoBytes); |
128 SetSendAlgorithm(kCubic); | 125 } else { |
129 } else { | 126 SetSendAlgorithm(kReno); |
130 SetSendAlgorithm(kCubicBytes); | 127 } |
| 128 } else if (config.HasClientRequestedIndependentOption(kBYTE, |
| 129 perspective_)) { |
| 130 if (FLAGS_quic_default_enable_cubic_bytes) { |
| 131 SetSendAlgorithm(kCubic); |
| 132 } else { |
| 133 SetSendAlgorithm(kCubicBytes); |
| 134 } |
| 135 } |
| 136 } else { |
| 137 if (FLAGS_quic_allow_new_bbr && config.HasReceivedConnectionOptions() && |
| 138 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { |
| 139 SetSendAlgorithm(kBBR); |
| 140 } |
| 141 if (config.HasReceivedConnectionOptions() && |
| 142 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { |
| 143 if (ContainsQuicTag(config.ReceivedConnectionOptions(), kBYTE)) { |
| 144 SetSendAlgorithm(kRenoBytes); |
| 145 } else { |
| 146 SetSendAlgorithm(kReno); |
| 147 } |
| 148 } else if (config.HasReceivedConnectionOptions() && |
| 149 ContainsQuicTag(config.ReceivedConnectionOptions(), kBYTE)) { |
| 150 if (FLAGS_quic_default_enable_cubic_bytes) { |
| 151 SetSendAlgorithm(kCubic); |
| 152 } else { |
| 153 SetSendAlgorithm(kCubicBytes); |
| 154 } |
131 } | 155 } |
132 } | 156 } |
133 using_pacing_ = !FLAGS_quic_disable_pacing_for_perf_tests; | 157 using_pacing_ = !FLAGS_quic_disable_pacing_for_perf_tests; |
134 | 158 |
135 if (config.HasClientSentConnectionOption(k1CON, perspective_)) { | 159 if (config.HasClientSentConnectionOption(k1CON, perspective_)) { |
136 send_algorithm_->SetNumEmulatedConnections(1); | 160 send_algorithm_->SetNumEmulatedConnections(1); |
137 } | 161 } |
138 if (config.HasClientSentConnectionOption(kNCON, perspective_)) { | 162 if (config.HasClientSentConnectionOption(kNCON, perspective_)) { |
139 n_connection_simulation_ = true; | 163 n_connection_simulation_ = true; |
140 } | 164 } |
141 if (config.HasClientSentConnectionOption(kNTLP, perspective_)) { | 165 if (config.HasClientSentConnectionOption(kNTLP, perspective_)) { |
142 max_tail_loss_probes_ = 0; | 166 max_tail_loss_probes_ = 0; |
143 } | 167 } |
144 if (config.HasClientSentConnectionOption(kTLPR, perspective_)) { | 168 if (config.HasClientSentConnectionOption(kTLPR, perspective_)) { |
145 enable_half_rtt_tail_loss_probe_ = true; | 169 enable_half_rtt_tail_loss_probe_ = true; |
146 } | 170 } |
147 if (config.HasClientSentConnectionOption(kNRTO, perspective_)) { | 171 if (config.HasClientSentConnectionOption(kNRTO, perspective_)) { |
148 use_new_rto_ = true; | 172 use_new_rto_ = true; |
149 } | 173 } |
150 if (config.HasReceivedConnectionOptions() && | 174 // Configure loss detection. |
151 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { | 175 if (enable_client_connection_options) { |
152 general_loss_algorithm_.SetLossDetectionType(kTime); | 176 if (config.HasClientRequestedIndependentOption(kTIME, perspective_)) { |
153 } | 177 general_loss_algorithm_.SetLossDetectionType(kTime); |
154 if (config.HasReceivedConnectionOptions() && | 178 } |
155 ContainsQuicTag(config.ReceivedConnectionOptions(), kATIM)) { | 179 if (config.HasClientRequestedIndependentOption(kATIM, perspective_)) { |
156 general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); | 180 general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); |
157 } | 181 } |
158 if (FLAGS_quic_enable_lazy_fack && config.HasReceivedConnectionOptions() && | 182 if (FLAGS_quic_enable_lazy_fack && |
159 ContainsQuicTag(config.ReceivedConnectionOptions(), kLFAK)) { | 183 config.HasClientRequestedIndependentOption(kLFAK, perspective_)) { |
160 general_loss_algorithm_.SetLossDetectionType(kLazyFack); | 184 general_loss_algorithm_.SetLossDetectionType(kLazyFack); |
| 185 } |
| 186 } else { |
| 187 if (config.HasReceivedConnectionOptions() && |
| 188 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { |
| 189 general_loss_algorithm_.SetLossDetectionType(kTime); |
| 190 } |
| 191 if (config.HasReceivedConnectionOptions() && |
| 192 ContainsQuicTag(config.ReceivedConnectionOptions(), kATIM)) { |
| 193 general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); |
| 194 } |
| 195 if (FLAGS_quic_enable_lazy_fack && config.HasReceivedConnectionOptions() && |
| 196 ContainsQuicTag(config.ReceivedConnectionOptions(), kLFAK)) { |
| 197 general_loss_algorithm_.SetLossDetectionType(kLazyFack); |
| 198 } |
161 } | 199 } |
162 if (config.HasClientSentConnectionOption(kUNDO, perspective_)) { | 200 if (config.HasClientSentConnectionOption(kUNDO, perspective_)) { |
163 undo_pending_retransmits_ = true; | 201 undo_pending_retransmits_ = true; |
164 } | 202 } |
165 if (FLAGS_quic_conservative_handshake_retransmits && | 203 if (FLAGS_quic_conservative_handshake_retransmits && |
166 config.HasClientSentConnectionOption(kCONH, perspective_)) { | 204 config.HasClientSentConnectionOption(kCONH, perspective_)) { |
167 conservative_handshake_retransmits_ = true; | 205 conservative_handshake_retransmits_ = true; |
168 } | 206 } |
169 send_algorithm_->SetFromConfig(config, perspective_); | 207 send_algorithm_->SetFromConfig(config, perspective_); |
170 | 208 |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 | 1056 |
1019 void QuicSentPacketManager::RemoveObsoletePackets() { | 1057 void QuicSentPacketManager::RemoveObsoletePackets() { |
1020 unacked_packets_.RemoveObsoletePackets(); | 1058 unacked_packets_.RemoveObsoletePackets(); |
1021 } | 1059 } |
1022 | 1060 |
1023 void QuicSentPacketManager::OnApplicationLimited() { | 1061 void QuicSentPacketManager::OnApplicationLimited() { |
1024 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 1062 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
1025 } | 1063 } |
1026 | 1064 |
1027 } // namespace net | 1065 } // namespace net |
OLD | NEW |