Index: net/quic/core/quic_sent_packet_manager.cc |
diff --git a/net/quic/core/quic_sent_packet_manager.cc b/net/quic/core/quic_sent_packet_manager.cc |
index 7738e34381d960a0033f8bb186034d746ee93a45..c38db4c754877cab3dfe28698576ab3faa1016e1 100644 |
--- a/net/quic/core/quic_sent_packet_manager.cc |
+++ b/net/quic/core/quic_sent_packet_manager.cc |
@@ -38,6 +38,9 @@ const size_t kMinTimeoutsBeforePathDegrading = 2; |
// This limits the tenth retransmitted packet to 10s after the initial CHLO. |
static const int64_t kMinHandshakeTimeoutMs = 10; |
+// Ensure the handshake timer isnt't faster than 25ms. |
+static const int64_t kConservativeMinHandshakeTimeoutMs = kMaxDelayedAckTimeMs; |
+ |
// Sends up to two tail loss probes before firing an RTO, |
// per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. |
static const size_t kDefaultMaxTailLossProbes = 2; |
@@ -85,6 +88,7 @@ QuicSentPacketManager::QuicSentPacketManager( |
using_pacing_(false), |
use_new_rto_(false), |
undo_pending_retransmits_(false), |
+ conservative_handshake_retransmits_(false), |
largest_newly_acked_(0), |
largest_mtu_acked_(0), |
handshake_confirmed_(false) { |
@@ -151,6 +155,10 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
if (config.HasClientSentConnectionOption(kUNDO, perspective_)) { |
undo_pending_retransmits_ = true; |
} |
+ if (FLAGS_quic_conservative_handshake_retransmits && |
+ config.HasClientSentConnectionOption(kCONH, perspective_)) { |
+ conservative_handshake_retransmits_ = true; |
+ } |
send_algorithm_->SetFromConfig(config, perspective_); |
if (network_change_visitor_ != nullptr) { |
@@ -816,11 +824,17 @@ const QuicTime::Delta QuicSentPacketManager::GetCryptoRetransmissionDelay() |
// This is equivalent to the TailLossProbeDelay, but slightly more aggressive |
// because crypto handshake messages don't incur a delayed ack time. |
QuicTime::Delta srtt = rtt_stats_.smoothed_rtt(); |
+ int64_t delay_ms; |
if (srtt.IsZero()) { |
srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_.initial_rtt_us()); |
} |
- int64_t delay_ms = max(kMinHandshakeTimeoutMs, |
- static_cast<int64_t>(1.5 * srtt.ToMilliseconds())); |
+ if (conservative_handshake_retransmits_) { |
+ delay_ms = max(kConservativeMinHandshakeTimeoutMs, |
+ static_cast<int64_t>(2 * srtt.ToMilliseconds())); |
+ } else { |
+ delay_ms = max(kMinHandshakeTimeoutMs, |
+ static_cast<int64_t>(1.5 * srtt.ToMilliseconds())); |
+ } |
return QuicTime::Delta::FromMilliseconds( |
delay_ms << consecutive_crypto_retransmission_count_); |
} |
@@ -845,14 +859,18 @@ const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const { |
} |
const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { |
- QuicTime::Delta retransmission_delay = send_algorithm_->RetransmissionDelay(); |
- if (retransmission_delay.IsZero()) { |
+ QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero(); |
+ if (rtt_stats_.smoothed_rtt().IsZero()) { |
// We are in the initial state, use default timeout values. |
retransmission_delay = |
QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs); |
- } else if (retransmission_delay.ToMilliseconds() < kMinRetransmissionTimeMs) { |
+ } else { |
retransmission_delay = |
- QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs); |
+ rtt_stats_.smoothed_rtt() + 4 * rtt_stats_.mean_deviation(); |
+ if (retransmission_delay.ToMilliseconds() < kMinRetransmissionTimeMs) { |
+ retransmission_delay = |
+ QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs); |
+ } |
} |
// Calculate exponential back off. |
@@ -944,7 +962,6 @@ void QuicSentPacketManager::OnConnectionMigration(QuicPathId, |
send_algorithm_->OnConnectionMigration(); |
} |
- |
void QuicSentPacketManager::SetDebugDelegate(DebugDelegate* debug_delegate) { |
debug_delegate_ = debug_delegate; |
} |