Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: net/quic/quic_sent_packet_manager.cc

Issue 471293002: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. 42 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe.
43 static const size_t kDefaultMaxTailLossProbes = 2; 43 static const size_t kDefaultMaxTailLossProbes = 2;
44 static const int64 kMinTailLossProbeTimeoutMs = 10; 44 static const int64 kMinTailLossProbeTimeoutMs = 10;
45 45
46 // Number of samples before we force a new recent min rtt to be captured. 46 // Number of samples before we force a new recent min rtt to be captured.
47 static const size_t kNumMinRttSamplesAfterQuiescence = 2; 47 static const size_t kNumMinRttSamplesAfterQuiescence = 2;
48 48
49 // Number of unpaced packets to send after quiescence. 49 // Number of unpaced packets to send after quiescence.
50 static const size_t kInitialUnpacedBurst = 10; 50 static const size_t kInitialUnpacedBurst = 10;
51 51
52 // Use a 1 minute window for Recent Min RTT with BBR.
53
54 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) { 52 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) {
55 if (transmission_info.retransmittable_frames == NULL) { 53 if (transmission_info.retransmittable_frames == NULL) {
56 return false; 54 return false;
57 } 55 }
58 return transmission_info.retransmittable_frames->HasCryptoHandshake() == 56 return transmission_info.retransmittable_frames->HasCryptoHandshake() ==
59 IS_HANDSHAKE; 57 IS_HANDSHAKE;
60 } 58 }
61 59
62 } // namespace 60 } // namespace
63 61
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); 106 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s));
109 } 107 }
110 send_algorithm_.reset( 108 send_algorithm_.reset(
111 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kBBR, stats_)); 109 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kBBR, stats_));
112 } 110 }
113 if (config.HasReceivedConnectionOptions() && 111 if (config.HasReceivedConnectionOptions() &&
114 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { 112 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) {
115 send_algorithm_.reset( 113 send_algorithm_.reset(
116 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_)); 114 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_));
117 } 115 }
118 if (config.congestion_feedback() == kPACE || 116 if (config.HasReceivedConnectionOptions() &&
119 (config.HasReceivedConnectionOptions() && 117 ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE)) {
120 ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE))) {
121 MaybeEnablePacing(); 118 MaybeEnablePacing();
122 } 119 }
123 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once 120 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once
124 // the ConnectionOptions code is live everywhere. 121 // the ConnectionOptions code is live everywhere.
125 if ((config.HasReceivedLossDetection() && 122 if ((config.HasReceivedLossDetection() &&
126 config.ReceivedLossDetection() == kTIME) || 123 config.ReceivedLossDetection() == kTIME) ||
127 (config.HasReceivedConnectionOptions() && 124 (config.HasReceivedConnectionOptions() &&
128 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME))) { 125 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME))) {
129 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); 126 loss_algorithm_.reset(LossDetectionInterface::Create(kTime));
130 } 127 }
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 HasRetransmittableData retransmittable) { 730 HasRetransmittableData retransmittable) {
734 // The TLP logic is entirely contained within QuicSentPacketManager, so the 731 // The TLP logic is entirely contained within QuicSentPacketManager, so the
735 // send algorithm does not need to be consulted. 732 // send algorithm does not need to be consulted.
736 if (pending_tlp_transmission_) { 733 if (pending_tlp_transmission_) {
737 return QuicTime::Delta::Zero(); 734 return QuicTime::Delta::Zero();
738 } 735 }
739 return send_algorithm_->TimeUntilSend( 736 return send_algorithm_->TimeUntilSend(
740 now, unacked_packets_.bytes_in_flight(), retransmittable); 737 now, unacked_packets_.bytes_in_flight(), retransmittable);
741 } 738 }
742 739
740 // Uses a 25ms delayed ack timer. Also helps with better signaling
741 // in low-bandwidth (< ~384 kbps), where an ack is sent per packet.
743 // Ensures that the Delayed Ack timer is always set to a value lesser 742 // Ensures that the Delayed Ack timer is always set to a value lesser
744 // than the retransmission timer's minimum value (MinRTO). We want the 743 // than the retransmission timer's minimum value (MinRTO). We want the
745 // delayed ack to get back to the QUIC peer before the sender's 744 // delayed ack to get back to the QUIC peer before the sender's
746 // retransmission timer triggers. Since we do not know the 745 // retransmission timer triggers. Since we do not know the
747 // reverse-path one-way delay, we assume equal delays for forward and 746 // reverse-path one-way delay, we assume equal delays for forward and
748 // reverse paths, and ensure that the timer is set to less than half 747 // reverse paths, and ensure that the timer is set to less than half
749 // of the MinRTO. 748 // of the MinRTO.
750 // There may be a value in making this delay adaptive with the help of 749 // There may be a value in making this delay adaptive with the help of
751 // the sender and a signaling mechanism -- if the sender uses a 750 // the sender and a signaling mechanism -- if the sender uses a
752 // different MinRTO, we may get spurious retransmissions. May not have 751 // different MinRTO, we may get spurious retransmissions. May not have
753 // any benefits, but if the delayed ack becomes a significant source 752 // any benefits, but if the delayed ack becomes a significant source
754 // of (likely, tail) latency, then consider such a mechanism. 753 // of (likely, tail) latency, then consider such a mechanism.
755 const QuicTime::Delta QuicSentPacketManager::DelayedAckTime() const { 754 const QuicTime::Delta QuicSentPacketManager::DelayedAckTime() const {
756 return QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs/2); 755 return QuicTime::Delta::FromMilliseconds(min(kMaxDelayedAckTime,
756 kMinRetransmissionTimeMs/2));
757 } 757 }
758 758
759 const QuicTime QuicSentPacketManager::GetRetransmissionTime() const { 759 const QuicTime QuicSentPacketManager::GetRetransmissionTime() const {
760 // Don't set the timer if there are no packets in flight or we've already 760 // Don't set the timer if there are no packets in flight or we've already
761 // queued a tlp transmission and it hasn't been sent yet. 761 // queued a tlp transmission and it hasn't been sent yet.
762 if (!unacked_packets_.HasInFlightPackets() || pending_tlp_transmission_) { 762 if (!unacked_packets_.HasInFlightPackets() || pending_tlp_transmission_) {
763 return QuicTime::Zero(); 763 return QuicTime::Zero();
764 } 764 }
765 switch (GetRetransmissionMode()) { 765 switch (GetRetransmissionMode()) {
766 case HANDSHAKE_MODE: 766 case HANDSHAKE_MODE:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 int64 delay_ms = max<int64>(kMinHandshakeTimeoutMs, 798 int64 delay_ms = max<int64>(kMinHandshakeTimeoutMs,
799 1.5 * rtt_stats_.SmoothedRtt().ToMilliseconds()); 799 1.5 * rtt_stats_.SmoothedRtt().ToMilliseconds());
800 return QuicTime::Delta::FromMilliseconds( 800 return QuicTime::Delta::FromMilliseconds(
801 delay_ms << consecutive_crypto_retransmission_count_); 801 delay_ms << consecutive_crypto_retransmission_count_);
802 } 802 }
803 803
804 const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const { 804 const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const {
805 QuicTime::Delta srtt = rtt_stats_.SmoothedRtt(); 805 QuicTime::Delta srtt = rtt_stats_.SmoothedRtt();
806 if (!unacked_packets_.HasMultipleInFlightPackets()) { 806 if (!unacked_packets_.HasMultipleInFlightPackets()) {
807 return QuicTime::Delta::Max( 807 return QuicTime::Delta::Max(
808 srtt.Multiply(1.5).Add(DelayedAckTime()), srtt.Multiply(2)); 808 srtt.Multiply(2), srtt.Multiply(1.5)
809 .Add(QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs/2)));
809 } 810 }
810 return QuicTime::Delta::FromMilliseconds( 811 return QuicTime::Delta::FromMilliseconds(
811 max(kMinTailLossProbeTimeoutMs, 812 max(kMinTailLossProbeTimeoutMs,
812 static_cast<int64>(2 * srtt.ToMilliseconds()))); 813 static_cast<int64>(2 * srtt.ToMilliseconds())));
813 } 814 }
814 815
815 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { 816 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const {
816 QuicTime::Delta retransmission_delay = send_algorithm_->RetransmissionDelay(); 817 QuicTime::Delta retransmission_delay = send_algorithm_->RetransmissionDelay();
817 // TODO(rch): This code should move to |send_algorithm_|. 818 // TODO(rch): This code should move to |send_algorithm_|.
818 if (retransmission_delay.IsZero()) { 819 if (retransmission_delay.IsZero()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 866
866 // Set up a pacing sender with a 5 millisecond alarm granularity. 867 // Set up a pacing sender with a 5 millisecond alarm granularity.
867 using_pacing_ = true; 868 using_pacing_ = true;
868 send_algorithm_.reset( 869 send_algorithm_.reset(
869 new PacingSender(send_algorithm_.release(), 870 new PacingSender(send_algorithm_.release(),
870 QuicTime::Delta::FromMilliseconds(5), 871 QuicTime::Delta::FromMilliseconds(5),
871 kInitialUnpacedBurst)); 872 kInitialUnpacedBurst));
872 } 873 }
873 874
874 } // namespace net 875 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698