| 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 } |
| 124 |
| 121 using_pacing_ = !FLAGS_quic_disable_pacing_for_perf_tests; | 125 using_pacing_ = !FLAGS_quic_disable_pacing_for_perf_tests; |
| 122 | 126 |
| 123 if (config.HasClientSentConnectionOption(k1CON, perspective_)) { | 127 if (config.HasClientSentConnectionOption(k1CON, perspective_)) { |
| 124 send_algorithm_->SetNumEmulatedConnections(1); | 128 send_algorithm_->SetNumEmulatedConnections(1); |
| 125 } | 129 } |
| 126 if (config.HasClientSentConnectionOption(kNCON, perspective_)) { | 130 if (config.HasClientSentConnectionOption(kNCON, perspective_)) { |
| 127 n_connection_simulation_ = true; | 131 n_connection_simulation_ = true; |
| 128 } | 132 } |
| 129 if (config.HasClientSentConnectionOption(kNTLP, perspective_)) { | 133 if (config.HasClientSentConnectionOption(kNTLP, perspective_)) { |
| 130 max_tail_loss_probes_ = 0; | 134 max_tail_loss_probes_ = 0; |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 QuicTime::Delta srtt = rtt_stats_.smoothed_rtt(); | 793 QuicTime::Delta srtt = rtt_stats_.smoothed_rtt(); |
| 790 if (srtt.IsZero()) { | 794 if (srtt.IsZero()) { |
| 791 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_.initial_rtt_us()); | 795 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_.initial_rtt_us()); |
| 792 } | 796 } |
| 793 if (enable_half_rtt_tail_loss_probe_ && consecutive_tlp_count_ == 0u) { | 797 if (enable_half_rtt_tail_loss_probe_ && consecutive_tlp_count_ == 0u) { |
| 794 return QuicTime::Delta::FromMilliseconds( | 798 return QuicTime::Delta::FromMilliseconds( |
| 795 std::max(kMinTailLossProbeTimeoutMs, | 799 std::max(kMinTailLossProbeTimeoutMs, |
| 796 static_cast<int64_t>(0.5 * srtt.ToMilliseconds()))); | 800 static_cast<int64_t>(0.5 * srtt.ToMilliseconds()))); |
| 797 } | 801 } |
| 798 if (!unacked_packets_.HasMultipleInFlightPackets()) { | 802 if (!unacked_packets_.HasMultipleInFlightPackets()) { |
| 799 return std::max(2 * srtt, | 803 return std::max(2 * srtt, 1.5 * srtt + QuicTime::Delta::FromMilliseconds( |
| 800 1.5 * srtt + QuicTime::Delta::FromMilliseconds( | 804 kMinRetransmissionTimeMs / 2)); |
| 801 kMinRetransmissionTimeMs / 2)); | |
| 802 } | 805 } |
| 803 return QuicTime::Delta::FromMilliseconds( | 806 return QuicTime::Delta::FromMilliseconds( |
| 804 std::max(kMinTailLossProbeTimeoutMs, | 807 std::max(kMinTailLossProbeTimeoutMs, |
| 805 static_cast<int64_t>(2 * srtt.ToMilliseconds()))); | 808 static_cast<int64_t>(2 * srtt.ToMilliseconds()))); |
| 806 } | 809 } |
| 807 | 810 |
| 808 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { | 811 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { |
| 809 QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero(); | 812 QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero(); |
| 810 if (rtt_stats_.smoothed_rtt().IsZero()) { | 813 if (rtt_stats_.smoothed_rtt().IsZero()) { |
| 811 // We are in the initial state, use default timeout values. | 814 // We are in the initial state, use default timeout values. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 950 |
| 948 void QuicSentPacketManager::OnApplicationLimited() { | 951 void QuicSentPacketManager::OnApplicationLimited() { |
| 949 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 952 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
| 950 } | 953 } |
| 951 | 954 |
| 952 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { | 955 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { |
| 953 return send_algorithm_.get(); | 956 return send_algorithm_.get(); |
| 954 } | 957 } |
| 955 | 958 |
| 956 } // namespace net | 959 } // namespace net |
| OLD | NEW |