| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 using_pacing_(false), | 90 using_pacing_(false), |
| 91 handshake_confirmed_(false) { | 91 handshake_confirmed_(false) { |
| 92 } | 92 } |
| 93 | 93 |
| 94 QuicSentPacketManager::~QuicSentPacketManager() { | 94 QuicSentPacketManager::~QuicSentPacketManager() { |
| 95 } | 95 } |
| 96 | 96 |
| 97 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { | 97 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
| 98 if (config.HasReceivedInitialRoundTripTimeUs() && | 98 if (config.HasReceivedInitialRoundTripTimeUs() && |
| 99 config.ReceivedInitialRoundTripTimeUs() > 0) { | 99 config.ReceivedInitialRoundTripTimeUs() > 0) { |
| 100 rtt_stats_.set_initial_rtt_us(min(kMaxInitialRoundTripTimeUs, | |
| 101 config.ReceivedInitialRoundTripTimeUs())); | |
| 102 } else if (config.HasInitialRoundTripTimeUsToSend()) { | |
| 103 rtt_stats_.set_initial_rtt_us( | 100 rtt_stats_.set_initial_rtt_us( |
| 104 min(kMaxInitialRoundTripTimeUs, | 101 max(kMinInitialRoundTripTimeUs, |
| 105 config.GetInitialRoundTripTimeUsToSend())); | 102 min(kMaxInitialRoundTripTimeUs, |
| 103 config.ReceivedInitialRoundTripTimeUs()))); |
| 104 } else if (config.HasInitialRoundTripTimeUsToSend() && |
| 105 config.GetInitialRoundTripTimeUsToSend() > 0) { |
| 106 rtt_stats_.set_initial_rtt_us( |
| 107 max(kMinInitialRoundTripTimeUs, |
| 108 min(kMaxInitialRoundTripTimeUs, |
| 109 config.GetInitialRoundTripTimeUsToSend()))); |
| 106 } | 110 } |
| 107 // TODO(ianswett): BBR is currently a server only feature. | 111 // TODO(ianswett): BBR is currently a server only feature. |
| 108 if (FLAGS_quic_allow_bbr && | 112 if (FLAGS_quic_allow_bbr && |
| 109 config.HasReceivedConnectionOptions() && | 113 config.HasReceivedConnectionOptions() && |
| 110 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { | 114 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { |
| 111 if (FLAGS_quic_recent_min_rtt_window_s > 0) { | 115 if (FLAGS_quic_recent_min_rtt_window_s > 0) { |
| 112 rtt_stats_.set_recent_min_rtt_window( | 116 rtt_stats_.set_recent_min_rtt_window( |
| 113 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); | 117 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); |
| 114 } | 118 } |
| 115 send_algorithm_.reset( | 119 send_algorithm_.reset( |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 910 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
| 907 // the default granularity of the Linux kernel's FQ qdisc. | 911 // the default granularity of the Linux kernel's FQ qdisc. |
| 908 using_pacing_ = true; | 912 using_pacing_ = true; |
| 909 send_algorithm_.reset( | 913 send_algorithm_.reset( |
| 910 new PacingSender(send_algorithm_.release(), | 914 new PacingSender(send_algorithm_.release(), |
| 911 QuicTime::Delta::FromMilliseconds(1), | 915 QuicTime::Delta::FromMilliseconds(1), |
| 912 kInitialUnpacedBurst)); | 916 kInitialUnpacedBurst)); |
| 913 } | 917 } |
| 914 | 918 |
| 915 } // namespace net | 919 } // namespace net |
| OLD | NEW |