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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (config.HasReceivedConnectionOptions() && | 166 if (config.HasReceivedConnectionOptions() && |
167 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { | 167 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { |
168 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); | 168 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); |
169 } | 169 } |
170 if (config.HasReceivedSocketReceiveBuffer()) { | 170 if (config.HasReceivedSocketReceiveBuffer()) { |
171 receive_buffer_bytes_ = | 171 receive_buffer_bytes_ = |
172 max(kMinSocketReceiveBuffer, | 172 max(kMinSocketReceiveBuffer, |
173 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); | 173 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); |
174 QuicByteCount max_cwnd_bytes = static_cast<QuicByteCount>( | 174 QuicByteCount max_cwnd_bytes = static_cast<QuicByteCount>( |
175 receive_buffer_bytes_ * kConservativeReceiveBufferFraction); | 175 receive_buffer_bytes_ * kConservativeReceiveBufferFraction); |
176 max_cwnd_bytes = min(max_cwnd_bytes, kMaxCongestionWindow * kDefaultTCPMSS); | 176 if (!FLAGS_quic_dont_limit_max_cwnd) { |
| 177 // TODO(ianswett): Remove kMaxCongestionWindow once deprecated. |
| 178 max_cwnd_bytes = |
| 179 min(max_cwnd_bytes, kMaxCongestionWindow * kDefaultTCPMSS); |
| 180 } |
177 send_algorithm_->SetMaxCongestionWindow(max_cwnd_bytes); | 181 send_algorithm_->SetMaxCongestionWindow(max_cwnd_bytes); |
178 } | 182 } |
179 send_algorithm_->SetFromConfig(config, perspective_); | 183 send_algorithm_->SetFromConfig(config, perspective_); |
180 | 184 |
181 if (network_change_visitor_ != nullptr) { | 185 if (network_change_visitor_ != nullptr) { |
182 network_change_visitor_->OnCongestionWindowChange(); | 186 network_change_visitor_->OnCongestionWindowChange(); |
183 } | 187 } |
184 } | 188 } |
185 | 189 |
186 void QuicSentPacketManager::ResumeConnectionState( | 190 void QuicSentPacketManager::ResumeConnectionState( |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 // Since we will not retransmit this, we need to remove it from | 720 // Since we will not retransmit this, we need to remove it from |
717 // unacked_packets_. This is either the current transmission of | 721 // unacked_packets_. This is either the current transmission of |
718 // a packet whose previous transmission has been acked or a packet that | 722 // a packet whose previous transmission has been acked or a packet that |
719 // has been TLP retransmitted. | 723 // has been TLP retransmitted. |
720 unacked_packets_.RemoveFromInFlight(pair.first); | 724 unacked_packets_.RemoveFromInFlight(pair.first); |
721 } | 725 } |
722 } | 726 } |
723 } | 727 } |
724 | 728 |
725 bool QuicSentPacketManager::MaybeUpdateRTT(const QuicAckFrame& ack_frame, | 729 bool QuicSentPacketManager::MaybeUpdateRTT(const QuicAckFrame& ack_frame, |
726 const QuicTime& ack_receive_time) { | 730 QuicTime ack_receive_time) { |
727 // We rely on ack_delay_time to compute an RTT estimate, so we | 731 // We rely on ack_delay_time to compute an RTT estimate, so we |
728 // only update rtt when the largest observed gets acked. | 732 // only update rtt when the largest observed gets acked. |
729 // NOTE: If ack is a truncated ack, then the largest observed is in fact | 733 // NOTE: If ack is a truncated ack, then the largest observed is in fact |
730 // unacked, and may cause an RTT sample to be taken. | 734 // unacked, and may cause an RTT sample to be taken. |
731 if (!unacked_packets_.IsUnacked(ack_frame.largest_observed)) { | 735 if (!unacked_packets_.IsUnacked(ack_frame.largest_observed)) { |
732 return false; | 736 return false; |
733 } | 737 } |
734 // We calculate the RTT based on the highest ACKed packet number, the lower | 738 // We calculate the RTT based on the highest ACKed packet number, the lower |
735 // packet numbers will include the ACK aggregation delay. | 739 // packet numbers will include the ACK aggregation delay. |
736 const TransmissionInfo& transmission_info = | 740 const TransmissionInfo& transmission_info = |
(...skipping 17 matching lines...) Expand all Loading... |
754 } | 758 } |
755 | 759 |
756 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( | 760 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( |
757 QuicTime now, | 761 QuicTime now, |
758 HasRetransmittableData retransmittable) { | 762 HasRetransmittableData retransmittable) { |
759 // The TLP logic is entirely contained within QuicSentPacketManager, so the | 763 // The TLP logic is entirely contained within QuicSentPacketManager, so the |
760 // send algorithm does not need to be consulted. | 764 // send algorithm does not need to be consulted. |
761 if (pending_timer_transmission_count_ > 0) { | 765 if (pending_timer_transmission_count_ > 0) { |
762 return QuicTime::Delta::Zero(); | 766 return QuicTime::Delta::Zero(); |
763 } | 767 } |
764 return send_algorithm_->TimeUntilSend(now, unacked_packets_.bytes_in_flight(), | 768 return send_algorithm_->TimeUntilSend(now, |
765 retransmittable); | 769 unacked_packets_.bytes_in_flight()); |
766 } | 770 } |
767 | 771 |
768 // Uses a 25ms delayed ack timer. Also helps with better signaling | 772 // Uses a 25ms delayed ack timer. Also helps with better signaling |
769 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet. | 773 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet. |
770 // Ensures that the Delayed Ack timer is always set to a value lesser | 774 // Ensures that the Delayed Ack timer is always set to a value lesser |
771 // than the retransmission timer's minimum value (MinRTO). We want the | 775 // than the retransmission timer's minimum value (MinRTO). We want the |
772 // delayed ack to get back to the QUIC peer before the sender's | 776 // delayed ack to get back to the QUIC peer before the sender's |
773 // retransmission timer triggers. Since we do not know the | 777 // retransmission timer triggers. Since we do not know the |
774 // reverse-path one-way delay, we assume equal delays for forward and | 778 // reverse-path one-way delay, we assume equal delays for forward and |
775 // reverse paths, and ensure that the timer is set to less than half | 779 // reverse paths, and ensure that the timer is set to less than half |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 961 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( |
958 QuicPacketNumber packet_number) { | 962 QuicPacketNumber packet_number) { |
959 return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 963 return unacked_packets_.GetMutableTransmissionInfo(packet_number); |
960 } | 964 } |
961 | 965 |
962 void QuicSentPacketManager::RemoveObsoletePackets() { | 966 void QuicSentPacketManager::RemoveObsoletePackets() { |
963 unacked_packets_.RemoveObsoletePackets(); | 967 unacked_packets_.RemoveObsoletePackets(); |
964 } | 968 } |
965 | 969 |
966 } // namespace net | 970 } // namespace net |
OLD | NEW |