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

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

Issue 112953003: Remove a QUIC test only flag(limit_rto_increase_for_tests) to limit the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/congestion_control/pacing_sender.h" 9 #include "net/quic/congestion_control/pacing_sender.h"
10 #include "net/quic/quic_ack_notifier_manager.h" 10 #include "net/quic/quic_ack_notifier_manager.h"
11 11
12 using std::make_pair; 12 using std::make_pair;
13 using std::max; 13 using std::max;
14 using std::min; 14 using std::min;
15 15
16 // TODO(rtenneti): Remove this. 16 // TODO(rtenneti): Remove this.
17 // Do not flip this flag until the flakiness of the 17 // Do not flip this flag until the flakiness of the
18 // net/tools/quic/end_to_end_test is fixed. 18 // net/tools/quic/end_to_end_test is fixed.
19 // If true, then QUIC connections will track the retransmission history of a 19 // If true, then QUIC connections will track the retransmission history of a
20 // packet so that an ack of a previous transmission will ack the data of all 20 // packet so that an ack of a previous transmission will ack the data of all
21 // other transmissions. 21 // other transmissions.
22 bool FLAGS_track_retransmission_history = false; 22 bool FLAGS_track_retransmission_history = false;
23 23
24 // A test-only flag to prevent the RTO from backing off when multiple sequential
25 // tail drops occur.
26 bool FLAGS_limit_rto_increase_for_tests = false;
27
28 // Do not remove this flag until the Finch-trials described in b/11706275 24 // Do not remove this flag until the Finch-trials described in b/11706275
29 // are complete. 25 // are complete.
30 // If true, QUIC connections will support the use of a pacing algorithm when 26 // If true, QUIC connections will support the use of a pacing algorithm when
31 // sending packets, in an attempt to reduce packet loss. The client must also 27 // sending packets, in an attempt to reduce packet loss. The client must also
32 // request pacing for the server to enable it. 28 // request pacing for the server to enable it.
33 bool FLAGS_enable_quic_pacing = false; 29 bool FLAGS_enable_quic_pacing = false;
34 30
35 namespace net { 31 namespace net {
36 namespace { 32 namespace {
37 static const int kBitrateSmoothingPeriodMs = 1000; 33 static const int kBitrateSmoothingPeriodMs = 1000;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 QuicTime rto_timeout = sent_time.Add(GetRetransmissionDelay()); 846 QuicTime rto_timeout = sent_time.Add(GetRetransmissionDelay());
851 847
852 return QuicTime::Max(min_timeout, rto_timeout); 848 return QuicTime::Max(min_timeout, rto_timeout);
853 } 849 }
854 default: 850 default:
855 DCHECK(false); 851 DCHECK(false);
856 } 852 }
857 return QuicTime::Zero(); 853 return QuicTime::Zero();
858 } 854 }
859 855
860 const QuicTime::Delta 856 const QuicTime::Delta QuicSentPacketManager::GetCryptoRetransmissionDelay()
861 QuicSentPacketManager::GetCryptoRetransmissionDelay() const { 857 const {
862 // This is equivalent to the TailLossProbeDelay, but slightly more aggressive 858 // This is equivalent to the TailLossProbeDelay, but slightly more aggressive
863 // because crypto handshake messages don't incur a delayed ack time. 859 // because crypto handshake messages don't incur a delayed ack time.
864 int64 delay_ms = max<int64>(kMinHandshakeTimeoutMs, 860 int64 delay_ms = max<int64>(kMinHandshakeTimeoutMs,
865 1.5 * SmoothedRtt().ToMilliseconds()); 861 1.5 * SmoothedRtt().ToMilliseconds());
866 return QuicTime::Delta::FromMilliseconds( 862 return QuicTime::Delta::FromMilliseconds(
867 delay_ms << consecutive_crypto_retransmission_count_); 863 delay_ms << consecutive_crypto_retransmission_count_);
868 } 864 }
869 865
870 const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const { 866 const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const {
871 QuicTime::Delta srtt = SmoothedRtt(); 867 QuicTime::Delta srtt = SmoothedRtt();
872 if (pending_packets_.size() == 1) { 868 if (pending_packets_.size() == 1) {
873 return QuicTime::Delta::Max( 869 return QuicTime::Delta::Max(
874 srtt.Multiply(1.5).Add(DelayedAckTime()), srtt.Multiply(2)); 870 srtt.Multiply(1.5).Add(DelayedAckTime()), srtt.Multiply(2));
875 } 871 }
876 return QuicTime::Delta::FromMilliseconds( 872 return QuicTime::Delta::FromMilliseconds(
877 max(kMinTailLossProbeTimeoutMs, 873 max(kMinTailLossProbeTimeoutMs,
878 static_cast<int64>(2 * srtt.ToMilliseconds()))); 874 static_cast<int64>(2 * srtt.ToMilliseconds())));
879 } 875 }
880 876
881 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { 877 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const {
882 size_t number_retransmissions = consecutive_rto_count_;
883 // TODO(ianswett): Remove this flag now that EndToEndTest is no longer flaky.
884 if (FLAGS_limit_rto_increase_for_tests) {
885 const size_t kTailDropWindowSize = 5;
886 const size_t kTailDropMaxRetransmissions = 4;
887 if (pending_packets_.size() <= kTailDropWindowSize) {
888 // Avoid exponential backoff of RTO when there are only a few packets
889 // outstanding. This helps avoid the situation where fake packet loss
890 // causes a packet and it's retransmission to be dropped causing
891 // test timouts.
892 if (number_retransmissions <= kTailDropMaxRetransmissions) {
893 number_retransmissions = 0;
894 } else {
895 number_retransmissions -= kTailDropMaxRetransmissions;
896 }
897 }
898 }
899
900 QuicTime::Delta retransmission_delay = send_algorithm_->RetransmissionDelay(); 878 QuicTime::Delta retransmission_delay = send_algorithm_->RetransmissionDelay();
901 if (retransmission_delay.IsZero()) { 879 if (retransmission_delay.IsZero()) {
902 // We are in the initial state, use default timeout values. 880 // We are in the initial state, use default timeout values.
903 retransmission_delay = 881 retransmission_delay =
904 QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs); 882 QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs);
905 } 883 }
906 // Calculate exponential back off. 884 // Calculate exponential back off.
907 retransmission_delay = retransmission_delay.Multiply( 885 retransmission_delay = retransmission_delay.Multiply(
908 1 << min<size_t>(number_retransmissions, kMaxRetransmissions)); 886 1 << min<size_t>(consecutive_rto_count_, kMaxRetransmissions));
909 887
910 // TODO(rch): This code should move to |send_algorithm_|. 888 // TODO(rch): This code should move to |send_algorithm_|.
911 if (retransmission_delay.ToMilliseconds() < kMinRetransmissionTimeMs) { 889 if (retransmission_delay.ToMilliseconds() < kMinRetransmissionTimeMs) {
912 return QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs); 890 return QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs);
913 } 891 }
914 if (retransmission_delay.ToMilliseconds() > kMaxRetransmissionTimeMs) { 892 if (retransmission_delay.ToMilliseconds() > kMaxRetransmissionTimeMs) {
915 return QuicTime::Delta::FromMilliseconds(kMaxRetransmissionTimeMs); 893 return QuicTime::Delta::FromMilliseconds(kMaxRetransmissionTimeMs);
916 } 894 }
917 return retransmission_delay; 895 return retransmission_delay;
918 } 896 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 return; 937 return;
960 } 938 }
961 939
962 using_pacing_ = true; 940 using_pacing_ = true;
963 send_algorithm_.reset( 941 send_algorithm_.reset(
964 new PacingSender(send_algorithm_.release(), 942 new PacingSender(send_algorithm_.release(),
965 QuicTime::Delta::FromMicroseconds(1))); 943 QuicTime::Delta::FromMicroseconds(1)));
966 } 944 }
967 945
968 } // namespace net 946 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698