| 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 "net/quic/chromium/quic_utils_chromium.h" | 10 #include "net/quic/chromium/quic_utils_chromium.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 SetSendAlgorithm(kBBR); | 110 SetSendAlgorithm(kBBR); |
| 111 } | 111 } |
| 112 if (config.HasClientRequestedIndependentOption(kRENO, perspective_)) { | 112 if (config.HasClientRequestedIndependentOption(kRENO, perspective_)) { |
| 113 if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { | 113 if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { |
| 114 SetSendAlgorithm(kRenoBytes); | 114 SetSendAlgorithm(kRenoBytes); |
| 115 } else { | 115 } else { |
| 116 SetSendAlgorithm(kReno); | 116 SetSendAlgorithm(kReno); |
| 117 } | 117 } |
| 118 } else if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { | 118 } else if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { |
| 119 SetSendAlgorithm(kCubic); | 119 SetSendAlgorithm(kCubic); |
| 120 } else if (FLAGS_quic_reloadable_flag_quic_enable_pcc && |
| 121 config.HasClientRequestedIndependentOption(kTPCC, perspective_)) { |
| 122 SetSendAlgorithm(kPCC); |
| 120 } | 123 } |
| 121 using_pacing_ = !FLAGS_quic_disable_pacing_for_perf_tests; | 124 |
| 125 // The PCCSender implements its own version of pacing through the |
| 126 // SendAlgorithm::TimeUntilSend() function. Do not wrap a |
| 127 // PacingSender around it, since wrapping a PacingSender around an |
| 128 // already paced SendAlgorithm produces a DCHECK. TODO(fayang): |
| 129 // Change this if/when the PCCSender uses the PacingSender. |
| 130 using_pacing_ = !FLAGS_quic_disable_pacing_for_perf_tests && |
| 131 send_algorithm_->GetCongestionControlType() != kPCC; |
| 122 | 132 |
| 123 if (config.HasClientSentConnectionOption(k1CON, perspective_)) { | 133 if (config.HasClientSentConnectionOption(k1CON, perspective_)) { |
| 124 send_algorithm_->SetNumEmulatedConnections(1); | 134 send_algorithm_->SetNumEmulatedConnections(1); |
| 125 } | 135 } |
| 126 if (config.HasClientSentConnectionOption(kNCON, perspective_)) { | 136 if (config.HasClientSentConnectionOption(kNCON, perspective_)) { |
| 127 n_connection_simulation_ = true; | 137 n_connection_simulation_ = true; |
| 128 } | 138 } |
| 129 if (config.HasClientSentConnectionOption(kNTLP, perspective_)) { | 139 if (config.HasClientSentConnectionOption(kNTLP, perspective_)) { |
| 130 max_tail_loss_probes_ = 0; | 140 max_tail_loss_probes_ = 0; |
| 131 } | 141 } |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 QuicTime::Delta srtt = rtt_stats_.smoothed_rtt(); | 799 QuicTime::Delta srtt = rtt_stats_.smoothed_rtt(); |
| 790 if (srtt.IsZero()) { | 800 if (srtt.IsZero()) { |
| 791 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_.initial_rtt_us()); | 801 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_.initial_rtt_us()); |
| 792 } | 802 } |
| 793 if (enable_half_rtt_tail_loss_probe_ && consecutive_tlp_count_ == 0u) { | 803 if (enable_half_rtt_tail_loss_probe_ && consecutive_tlp_count_ == 0u) { |
| 794 return QuicTime::Delta::FromMilliseconds( | 804 return QuicTime::Delta::FromMilliseconds( |
| 795 std::max(kMinTailLossProbeTimeoutMs, | 805 std::max(kMinTailLossProbeTimeoutMs, |
| 796 static_cast<int64_t>(0.5 * srtt.ToMilliseconds()))); | 806 static_cast<int64_t>(0.5 * srtt.ToMilliseconds()))); |
| 797 } | 807 } |
| 798 if (!unacked_packets_.HasMultipleInFlightPackets()) { | 808 if (!unacked_packets_.HasMultipleInFlightPackets()) { |
| 799 return std::max(2 * srtt, | 809 return std::max(2 * srtt, 1.5 * srtt + QuicTime::Delta::FromMilliseconds( |
| 800 1.5 * srtt + QuicTime::Delta::FromMilliseconds( | 810 kMinRetransmissionTimeMs / 2)); |
| 801 kMinRetransmissionTimeMs / 2)); | |
| 802 } | 811 } |
| 803 return QuicTime::Delta::FromMilliseconds( | 812 return QuicTime::Delta::FromMilliseconds( |
| 804 std::max(kMinTailLossProbeTimeoutMs, | 813 std::max(kMinTailLossProbeTimeoutMs, |
| 805 static_cast<int64_t>(2 * srtt.ToMilliseconds()))); | 814 static_cast<int64_t>(2 * srtt.ToMilliseconds()))); |
| 806 } | 815 } |
| 807 | 816 |
| 808 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { | 817 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { |
| 809 QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero(); | 818 QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero(); |
| 810 if (rtt_stats_.smoothed_rtt().IsZero()) { | 819 if (rtt_stats_.smoothed_rtt().IsZero()) { |
| 811 // We are in the initial state, use default timeout values. | 820 // We are in the initial state, use default timeout values. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 956 |
| 948 void QuicSentPacketManager::OnApplicationLimited() { | 957 void QuicSentPacketManager::OnApplicationLimited() { |
| 949 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 958 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
| 950 } | 959 } |
| 951 | 960 |
| 952 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { | 961 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { |
| 953 return send_algorithm_.get(); | 962 return send_algorithm_.get(); |
| 954 } | 963 } |
| 955 | 964 |
| 956 } // namespace net | 965 } // namespace net |
| OLD | NEW |