| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { | 131 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { |
| 132 if (FLAGS_quic_recent_min_rtt_window_s > 0) { | 132 if (FLAGS_quic_recent_min_rtt_window_s > 0) { |
| 133 rtt_stats_.set_recent_min_rtt_window( | 133 rtt_stats_.set_recent_min_rtt_window( |
| 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 if (ContainsQuicTag(config.ReceivedConnectionOptions(), kBYTE)) { |
| 142 send_algorithm_.reset(SendAlgorithmInterface::Create( |
| 143 clock_, &rtt_stats_, kRenoBytes, stats_, initial_congestion_window_)); |
| 144 } else { |
| 145 send_algorithm_.reset(SendAlgorithmInterface::Create( |
| 146 clock_, &rtt_stats_, kReno, stats_, initial_congestion_window_)); |
| 147 } |
| 148 } else if (config.HasReceivedConnectionOptions() && |
| 149 ContainsQuicTag(config.ReceivedConnectionOptions(), kBYTE)) { |
| 141 send_algorithm_.reset(SendAlgorithmInterface::Create( | 150 send_algorithm_.reset(SendAlgorithmInterface::Create( |
| 142 clock_, &rtt_stats_, kReno, stats_, initial_congestion_window_)); | 151 clock_, &rtt_stats_, kCubicBytes, stats_, initial_congestion_window_)); |
| 143 } | 152 } |
| 144 EnablePacing(); | 153 EnablePacing(); |
| 145 | 154 |
| 146 if (HasClientSentConnectionOption(config, k1CON)) { | 155 if (HasClientSentConnectionOption(config, k1CON)) { |
| 147 send_algorithm_->SetNumEmulatedConnections(1); | 156 send_algorithm_->SetNumEmulatedConnections(1); |
| 148 } | 157 } |
| 149 if (HasClientSentConnectionOption(config, kNCON)) { | 158 if (HasClientSentConnectionOption(config, kNCON)) { |
| 150 n_connection_simulation_ = true; | 159 n_connection_simulation_ = true; |
| 151 } | 160 } |
| 152 if (HasClientSentConnectionOption(config, kNTLP)) { | 161 if (HasClientSentConnectionOption(config, kNTLP)) { |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 | 934 |
| 926 QuicPacketCount QuicSentPacketManager::GetSlowStartThresholdInTcpMss() const { | 935 QuicPacketCount QuicSentPacketManager::GetSlowStartThresholdInTcpMss() const { |
| 927 return send_algorithm_->GetSlowStartThreshold() / kDefaultTCPMSS; | 936 return send_algorithm_->GetSlowStartThreshold() / kDefaultTCPMSS; |
| 928 } | 937 } |
| 929 | 938 |
| 930 void QuicSentPacketManager::OnSerializedPacket( | 939 void QuicSentPacketManager::OnSerializedPacket( |
| 931 const SerializedPacket& serialized_packet) { | 940 const SerializedPacket& serialized_packet) { |
| 932 ack_notifier_manager_.OnSerializedPacket(serialized_packet); | 941 ack_notifier_manager_.OnSerializedPacket(serialized_packet); |
| 933 } | 942 } |
| 934 | 943 |
| 944 void QuicSentPacketManager::CancelRetransmissionsForStream( |
| 945 QuicStreamId stream_id) { |
| 946 unacked_packets_.CancelRetransmissionsForStream(stream_id); |
| 947 PendingRetransmissionMap::iterator it = pending_retransmissions_.begin(); |
| 948 while (it != pending_retransmissions_.end()) { |
| 949 if (HasRetransmittableFrames(it->first)) { |
| 950 ++it; |
| 951 continue; |
| 952 } |
| 953 it = pending_retransmissions_.erase(it); |
| 954 } |
| 955 } |
| 956 |
| 935 void QuicSentPacketManager::EnablePacing() { | 957 void QuicSentPacketManager::EnablePacing() { |
| 936 // TODO(ianswett): Replace with a method which wraps the send algorithm in a | 958 // TODO(ianswett): Replace with a method which wraps the send algorithm in a |
| 937 // pacer every time a new algorithm is set. | 959 // pacer every time a new algorithm is set. |
| 938 if (using_pacing_) { | 960 if (using_pacing_) { |
| 939 return; | 961 return; |
| 940 } | 962 } |
| 941 | 963 |
| 942 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 964 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
| 943 // the default granularity of the Linux kernel's FQ qdisc. | 965 // the default granularity of the Linux kernel's FQ qdisc. |
| 944 using_pacing_ = true; | 966 using_pacing_ = true; |
| 945 send_algorithm_.reset( | 967 send_algorithm_.reset( |
| 946 new PacingSender(send_algorithm_.release(), | 968 new PacingSender(send_algorithm_.release(), |
| 947 QuicTime::Delta::FromMilliseconds(1), | 969 QuicTime::Delta::FromMilliseconds(1), |
| 948 kInitialUnpacedBurst)); | 970 kInitialUnpacedBurst)); |
| 949 } | 971 } |
| 950 | 972 |
| 951 } // namespace net | 973 } // namespace net |
| OLD | NEW |