summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@chromium.org>2014-11-13 18:56:38 -0800
committerRaman Tenneti <rtenneti@chromium.org>2014-11-14 03:01:00 +0000
commitc2b8e01e03e1f94a13c3944adaf1995459b523b4 (patch)
tree60dd66d8dfaa9f8b8b41b70dac101c2745ef768b
parenta77a3d3d33a6913abc4a8ed6d3fdf58ac80ab42f (diff)
downloadchromium_src-c2b8e01e03e1f94a13c3944adaf1995459b523b4.zip
chromium_src-c2b8e01e03e1f94a13c3944adaf1995459b523b4.tar.gz
chromium_src-c2b8e01e03e1f94a13c3944adaf1995459b523b4.tar.bz2
Fix a case when the initial rtt could be 0 when the client tries to
use 0 in QuicConfig. Also ensures the initail_rtt is always at least 15ms. Merge internal change: 79686080 BUG=431658 TBR=rch@chromium.org Review URL: https://codereview.chromium.org/714143005 Cr-Commit-Position: refs/heads/master@{#303732} (cherry picked from commit fc97ab64f59827a7438bc04ba57175edbdc45c34) Review URL: https://codereview.chromium.org/724283002 Cr-Commit-Position: refs/branch-heads/2214@{#37} Cr-Branched-From: 03655fd3f6d72165dc3c9bd2c89807305316fe6c-refs/heads/master@{#303346}
-rw-r--r--net/quic/quic_protocol.h3
-rw-r--r--net/quic/quic_sent_packet_manager.cc14
-rw-r--r--net/quic/quic_time.h2
-rw-r--r--net/tools/quic/end_to_end_test.cc8
4 files changed, 18 insertions, 9 deletions
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h
index afd5ed4..ad920d0 100644
--- a/net/quic/quic_protocol.h
+++ b/net/quic/quic_protocol.h
@@ -76,6 +76,9 @@ const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024;
// Smaller values are ignored.
const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024;
+// Don't allow a client to suggest an RTT shorter than 10ms.
+const uint32 kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli;
+
// Don't allow a client to suggest an RTT longer than 15 seconds.
const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond;
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc
index bdf8690..9e2d04f 100644
--- a/net/quic/quic_sent_packet_manager.cc
+++ b/net/quic/quic_sent_packet_manager.cc
@@ -97,12 +97,16 @@ QuicSentPacketManager::~QuicSentPacketManager() {
void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
if (config.HasReceivedInitialRoundTripTimeUs() &&
config.ReceivedInitialRoundTripTimeUs() > 0) {
- rtt_stats_.set_initial_rtt_us(min(kMaxInitialRoundTripTimeUs,
- config.ReceivedInitialRoundTripTimeUs()));
- } else if (config.HasInitialRoundTripTimeUsToSend()) {
rtt_stats_.set_initial_rtt_us(
- min(kMaxInitialRoundTripTimeUs,
- config.GetInitialRoundTripTimeUsToSend()));
+ max(kMinInitialRoundTripTimeUs,
+ min(kMaxInitialRoundTripTimeUs,
+ config.ReceivedInitialRoundTripTimeUs())));
+ } else if (config.HasInitialRoundTripTimeUsToSend() &&
+ config.GetInitialRoundTripTimeUsToSend() > 0) {
+ rtt_stats_.set_initial_rtt_us(
+ max(kMinInitialRoundTripTimeUs,
+ min(kMaxInitialRoundTripTimeUs,
+ config.GetInitialRoundTripTimeUsToSend())));
}
// TODO(ianswett): BBR is currently a server only feature.
if (FLAGS_quic_allow_bbr &&
diff --git a/net/quic/quic_time.h b/net/quic/quic_time.h
index 5fbe30c..53e5ebe 100644
--- a/net/quic/quic_time.h
+++ b/net/quic/quic_time.h
@@ -18,6 +18,8 @@
namespace net {
static const uint64 kNumMicrosPerSecond = base::Time::kMicrosecondsPerSecond;
+static const uint64 kNumMicrosPerMilli =
+ base::Time::kMicrosecondsPerMillisecond;
// A QuicTime is a purely relative time. QuicTime values from different clocks
// cannot be compared to each other. If you need an absolute time, see
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index 55e2d88..1fb3e79 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -924,7 +924,7 @@ TEST_P(EndToEndTest, LimitCongestionWindowAndRTT) {
// Client tries to request twice the server's max initial window, and the
// server limits it to the max.
client_config_.SetInitialCongestionWindowToSend(2 * kMaxInitialWindow);
- client_config_.SetInitialRoundTripTimeUsToSend(1000);
+ client_config_.SetInitialRoundTripTimeUsToSend(20000);
ASSERT_TRUE(Initialize());
client_->client()->WaitForCryptoHandshakeConfirmed();
@@ -949,9 +949,9 @@ TEST_P(EndToEndTest, LimitCongestionWindowAndRTT) {
EXPECT_EQ(GetParam().use_pacing, server_sent_packet_manager.using_pacing());
EXPECT_EQ(GetParam().use_pacing, client_sent_packet_manager.using_pacing());
- // The client *should* set the intitial RTT.
- EXPECT_EQ(1000u, client_sent_packet_manager.GetRttStats()->initial_rtt_us());
- EXPECT_EQ(1000u, server_sent_packet_manager.GetRttStats()->initial_rtt_us());
+ // The client *should* set the intitial RTT, but it's increased to 10ms.
+ EXPECT_EQ(20000u, client_sent_packet_manager.GetRttStats()->initial_rtt_us());
+ EXPECT_EQ(20000u, server_sent_packet_manager.GetRttStats()->initial_rtt_us());
// Now use the negotiated limits with packet loss.
SetPacketLossPercentage(30);