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/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); | 134 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); |
135 } | 135 } |
136 send_algorithm_.reset(SendAlgorithmInterface::Create( | 136 send_algorithm_.reset(SendAlgorithmInterface::Create( |
137 clock_, &rtt_stats_, kBBR, stats_, initial_congestion_window_)); | 137 clock_, &rtt_stats_, kBBR, stats_, initial_congestion_window_)); |
138 } | 138 } |
139 if (config.HasReceivedConnectionOptions() && | 139 if (config.HasReceivedConnectionOptions() && |
140 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { | 140 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { |
141 send_algorithm_.reset(SendAlgorithmInterface::Create( | 141 send_algorithm_.reset(SendAlgorithmInterface::Create( |
142 clock_, &rtt_stats_, kReno, stats_, initial_congestion_window_)); | 142 clock_, &rtt_stats_, kReno, stats_, initial_congestion_window_)); |
143 } | 143 } |
144 if (HasClientSentConnectionOption(config, kPACE) || | 144 EnablePacing(); |
145 FLAGS_quic_enable_pacing || | 145 |
146 (FLAGS_quic_allow_bbr && HasClientSentConnectionOption(config, kTBBR))) { | |
147 EnablePacing(); | |
148 } | |
149 if (HasClientSentConnectionOption(config, k1CON)) { | 146 if (HasClientSentConnectionOption(config, k1CON)) { |
150 send_algorithm_->SetNumEmulatedConnections(1); | 147 send_algorithm_->SetNumEmulatedConnections(1); |
151 } | 148 } |
152 if (HasClientSentConnectionOption(config, kNCON)) { | 149 if (HasClientSentConnectionOption(config, kNCON)) { |
153 n_connection_simulation_ = true; | 150 n_connection_simulation_ = true; |
154 } | 151 } |
155 if (HasClientSentConnectionOption(config, kNTLP)) { | 152 if (HasClientSentConnectionOption(config, kNTLP)) { |
156 max_tail_loss_probes_ = 0; | 153 max_tail_loss_probes_ = 0; |
157 } | 154 } |
158 if (HasClientSentConnectionOption(config, kNRTO)) { | 155 if (HasClientSentConnectionOption(config, kNRTO)) { |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 QuicPacketCount QuicSentPacketManager::GetSlowStartThresholdInTcpMss() const { | 926 QuicPacketCount QuicSentPacketManager::GetSlowStartThresholdInTcpMss() const { |
930 return send_algorithm_->GetSlowStartThreshold() / kDefaultTCPMSS; | 927 return send_algorithm_->GetSlowStartThreshold() / kDefaultTCPMSS; |
931 } | 928 } |
932 | 929 |
933 void QuicSentPacketManager::OnSerializedPacket( | 930 void QuicSentPacketManager::OnSerializedPacket( |
934 const SerializedPacket& serialized_packet) { | 931 const SerializedPacket& serialized_packet) { |
935 ack_notifier_manager_.OnSerializedPacket(serialized_packet); | 932 ack_notifier_manager_.OnSerializedPacket(serialized_packet); |
936 } | 933 } |
937 | 934 |
938 void QuicSentPacketManager::EnablePacing() { | 935 void QuicSentPacketManager::EnablePacing() { |
| 936 // TODO(ianswett): Replace with a method which wraps the send algorithm in a |
| 937 // pacer every time a new algorithm is set. |
939 if (using_pacing_) { | 938 if (using_pacing_) { |
940 return; | 939 return; |
941 } | 940 } |
942 | 941 |
943 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 942 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
944 // the default granularity of the Linux kernel's FQ qdisc. | 943 // the default granularity of the Linux kernel's FQ qdisc. |
945 using_pacing_ = true; | 944 using_pacing_ = true; |
946 send_algorithm_.reset( | 945 send_algorithm_.reset( |
947 new PacingSender(send_algorithm_.release(), | 946 new PacingSender(send_algorithm_.release(), |
948 QuicTime::Delta::FromMilliseconds(1), | 947 QuicTime::Delta::FromMilliseconds(1), |
949 kInitialUnpacedBurst)); | 948 kInitialUnpacedBurst)); |
950 } | 949 } |
951 | 950 |
952 } // namespace net | 951 } // namespace net |
OLD | NEW |