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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 use_new_rto_ = true; | 159 use_new_rto_ = true; |
160 } | 160 } |
161 if (config.HasReceivedConnectionOptions() && | 161 if (config.HasReceivedConnectionOptions() && |
162 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { | 162 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { |
163 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); | 163 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); |
164 } | 164 } |
165 if (config.HasReceivedSocketReceiveBuffer()) { | 165 if (config.HasReceivedSocketReceiveBuffer()) { |
166 receive_buffer_bytes_ = | 166 receive_buffer_bytes_ = |
167 max(kMinSocketReceiveBuffer, | 167 max(kMinSocketReceiveBuffer, |
168 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); | 168 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); |
169 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) { | 169 send_algorithm_->SetMaxCongestionWindow(receive_buffer_bytes_ * |
170 send_algorithm_->SetMaxCongestionWindow(receive_buffer_bytes_ * | 170 kUsableRecieveBufferFraction); |
171 kUsableRecieveBufferFraction); | |
172 } | |
173 } | 171 } |
174 send_algorithm_->SetFromConfig(config, perspective_); | 172 send_algorithm_->SetFromConfig(config, perspective_); |
175 | 173 |
176 if (network_change_visitor_ != nullptr) { | 174 if (network_change_visitor_ != nullptr) { |
177 network_change_visitor_->OnCongestionWindowChange(); | 175 network_change_visitor_->OnCongestionWindowChange(); |
178 } | 176 } |
179 } | 177 } |
180 | 178 |
181 bool QuicSentPacketManager::ResumeConnectionState( | 179 bool QuicSentPacketManager::ResumeConnectionState( |
182 const CachedNetworkParameters& cached_network_params, | 180 const CachedNetworkParameters& cached_network_params, |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 } | 774 } |
777 | 775 |
778 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( | 776 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( |
779 QuicTime now, | 777 QuicTime now, |
780 HasRetransmittableData retransmittable) { | 778 HasRetransmittableData retransmittable) { |
781 // The TLP logic is entirely contained within QuicSentPacketManager, so the | 779 // The TLP logic is entirely contained within QuicSentPacketManager, so the |
782 // send algorithm does not need to be consulted. | 780 // send algorithm does not need to be consulted. |
783 if (pending_timer_transmission_count_ > 0) { | 781 if (pending_timer_transmission_count_ > 0) { |
784 return QuicTime::Delta::Zero(); | 782 return QuicTime::Delta::Zero(); |
785 } | 783 } |
786 if (!FLAGS_quic_limit_max_cwnd_to_receive_buffer && | |
787 unacked_packets_.bytes_in_flight() >= | |
788 kUsableRecieveBufferFraction * receive_buffer_bytes_) { | |
789 return QuicTime::Delta::Infinite(); | |
790 } | |
791 return send_algorithm_->TimeUntilSend( | 784 return send_algorithm_->TimeUntilSend( |
792 now, unacked_packets_.bytes_in_flight(), retransmittable); | 785 now, unacked_packets_.bytes_in_flight(), retransmittable); |
793 } | 786 } |
794 | 787 |
795 // Uses a 25ms delayed ack timer. Also helps with better signaling | 788 // Uses a 25ms delayed ack timer. Also helps with better signaling |
796 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet. | 789 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet. |
797 // Ensures that the Delayed Ack timer is always set to a value lesser | 790 // Ensures that the Delayed Ack timer is always set to a value lesser |
798 // than the retransmission timer's minimum value (MinRTO). We want the | 791 // than the retransmission timer's minimum value (MinRTO). We want the |
799 // delayed ack to get back to the QUIC peer before the sender's | 792 // delayed ack to get back to the QUIC peer before the sender's |
800 // retransmission timer triggers. Since we do not know the | 793 // retransmission timer triggers. Since we do not know the |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 950 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
958 // the default granularity of the Linux kernel's FQ qdisc. | 951 // the default granularity of the Linux kernel's FQ qdisc. |
959 using_pacing_ = true; | 952 using_pacing_ = true; |
960 send_algorithm_.reset( | 953 send_algorithm_.reset( |
961 new PacingSender(send_algorithm_.release(), | 954 new PacingSender(send_algorithm_.release(), |
962 QuicTime::Delta::FromMilliseconds(1), | 955 QuicTime::Delta::FromMilliseconds(1), |
963 kInitialUnpacedBurst)); | 956 kInitialUnpacedBurst)); |
964 } | 957 } |
965 | 958 |
966 } // namespace net | 959 } // namespace net |
OLD | NEW |