| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 send_algorithm_->SetFromConfig(config, is_server_, using_pacing_); | 159 send_algorithm_->SetFromConfig(config, is_server_, using_pacing_); |
| 160 | 160 |
| 161 if (network_change_visitor_ != nullptr) { | 161 if (network_change_visitor_ != nullptr) { |
| 162 network_change_visitor_->OnCongestionWindowChange(); | 162 network_change_visitor_->OnCongestionWindowChange(); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool QuicSentPacketManager::ResumeConnectionState( | 166 bool QuicSentPacketManager::ResumeConnectionState( |
| 167 const CachedNetworkParameters& cached_network_params) { | 167 const CachedNetworkParameters& cached_network_params) { |
| 168 if (cached_network_params.has_min_rtt_ms()) { |
| 169 uint32 initial_rtt_us = |
| 170 kNumMicrosPerMilli * cached_network_params.min_rtt_ms(); |
| 171 rtt_stats_.set_initial_rtt_us( |
| 172 max(kMinInitialRoundTripTimeUs, |
| 173 min(kMaxInitialRoundTripTimeUs, initial_rtt_us))); |
| 174 } |
| 168 return send_algorithm_->ResumeConnectionState(cached_network_params); | 175 return send_algorithm_->ResumeConnectionState(cached_network_params); |
| 169 } | 176 } |
| 170 | 177 |
| 171 void QuicSentPacketManager::SetNumOpenStreams(size_t num_streams) { | 178 void QuicSentPacketManager::SetNumOpenStreams(size_t num_streams) { |
| 172 if (n_connection_simulation_) { | 179 if (n_connection_simulation_) { |
| 173 // Ensure the number of connections is between 1 and 5. | 180 // Ensure the number of connections is between 1 and 5. |
| 174 send_algorithm_->SetNumEmulatedConnections( | 181 send_algorithm_->SetNumEmulatedConnections( |
| 175 min<size_t>(5, max<size_t>(1, num_streams))); | 182 min<size_t>(5, max<size_t>(1, num_streams))); |
| 176 } | 183 } |
| 177 } | 184 } |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 940 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
| 934 // the default granularity of the Linux kernel's FQ qdisc. | 941 // the default granularity of the Linux kernel's FQ qdisc. |
| 935 using_pacing_ = true; | 942 using_pacing_ = true; |
| 936 send_algorithm_.reset( | 943 send_algorithm_.reset( |
| 937 new PacingSender(send_algorithm_.release(), | 944 new PacingSender(send_algorithm_.release(), |
| 938 QuicTime::Delta::FromMilliseconds(1), | 945 QuicTime::Delta::FromMilliseconds(1), |
| 939 kInitialUnpacedBurst)); | 946 kInitialUnpacedBurst)); |
| 940 } | 947 } |
| 941 | 948 |
| 942 } // namespace net | 949 } // namespace net |
| OLD | NEW |