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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 use_new_rto_ = true; | 165 use_new_rto_ = true; |
166 } | 166 } |
167 if (config.HasReceivedConnectionOptions() && | 167 if (config.HasReceivedConnectionOptions() && |
168 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { | 168 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { |
169 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); | 169 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); |
170 } | 170 } |
171 if (config.HasReceivedSocketReceiveBuffer()) { | 171 if (config.HasReceivedSocketReceiveBuffer()) { |
172 receive_buffer_bytes_ = | 172 receive_buffer_bytes_ = |
173 max(kMinSocketReceiveBuffer, | 173 max(kMinSocketReceiveBuffer, |
174 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); | 174 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); |
| 175 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) { |
| 176 send_algorithm_->SetMaxCongestionWindow(receive_buffer_bytes_ * |
| 177 kUsableRecieveBufferFraction); |
| 178 } |
175 } | 179 } |
176 send_algorithm_->SetFromConfig(config, perspective_, using_pacing_); | 180 send_algorithm_->SetFromConfig(config, perspective_, using_pacing_); |
177 | 181 |
178 if (network_change_visitor_ != nullptr) { | 182 if (network_change_visitor_ != nullptr) { |
179 network_change_visitor_->OnCongestionWindowChange(); | 183 network_change_visitor_->OnCongestionWindowChange(); |
180 } | 184 } |
181 } | 185 } |
182 | 186 |
183 bool QuicSentPacketManager::ResumeConnectionState( | 187 bool QuicSentPacketManager::ResumeConnectionState( |
184 const CachedNetworkParameters& cached_network_params) { | 188 const CachedNetworkParameters& cached_network_params) { |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 788 } |
785 | 789 |
786 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( | 790 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( |
787 QuicTime now, | 791 QuicTime now, |
788 HasRetransmittableData retransmittable) { | 792 HasRetransmittableData retransmittable) { |
789 // The TLP logic is entirely contained within QuicSentPacketManager, so the | 793 // The TLP logic is entirely contained within QuicSentPacketManager, so the |
790 // send algorithm does not need to be consulted. | 794 // send algorithm does not need to be consulted. |
791 if (pending_timer_transmission_count_ > 0) { | 795 if (pending_timer_transmission_count_ > 0) { |
792 return QuicTime::Delta::Zero(); | 796 return QuicTime::Delta::Zero(); |
793 } | 797 } |
794 if (unacked_packets_.bytes_in_flight() >= | 798 if (!FLAGS_quic_limit_max_cwnd_to_receive_buffer && |
795 kUsableRecieveBufferFraction * receive_buffer_bytes_) { | 799 unacked_packets_.bytes_in_flight() >= |
| 800 kUsableRecieveBufferFraction * receive_buffer_bytes_) { |
796 return QuicTime::Delta::Infinite(); | 801 return QuicTime::Delta::Infinite(); |
797 } | 802 } |
798 return send_algorithm_->TimeUntilSend( | 803 return send_algorithm_->TimeUntilSend( |
799 now, unacked_packets_.bytes_in_flight(), retransmittable); | 804 now, unacked_packets_.bytes_in_flight(), retransmittable); |
800 } | 805 } |
801 | 806 |
802 // Uses a 25ms delayed ack timer. Also helps with better signaling | 807 // Uses a 25ms delayed ack timer. Also helps with better signaling |
803 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet. | 808 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet. |
804 // Ensures that the Delayed Ack timer is always set to a value lesser | 809 // Ensures that the Delayed Ack timer is always set to a value lesser |
805 // than the retransmission timer's minimum value (MinRTO). We want the | 810 // than the retransmission timer's minimum value (MinRTO). We want the |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 969 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
965 // the default granularity of the Linux kernel's FQ qdisc. | 970 // the default granularity of the Linux kernel's FQ qdisc. |
966 using_pacing_ = true; | 971 using_pacing_ = true; |
967 send_algorithm_.reset( | 972 send_algorithm_.reset( |
968 new PacingSender(send_algorithm_.release(), | 973 new PacingSender(send_algorithm_.release(), |
969 QuicTime::Delta::FromMilliseconds(1), | 974 QuicTime::Delta::FromMilliseconds(1), |
970 kInitialUnpacedBurst)); | 975 kInitialUnpacedBurst)); |
971 } | 976 } |
972 | 977 |
973 } // namespace net | 978 } // namespace net |
OLD | NEW |