Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index 3e807a35281453173730faff0259dea8612d4b5d..afd5e50e4e401d832fcc311d610e09f3305b5e8b 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -235,6 +235,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id, |
pending_version_negotiation_packet_(false), |
save_crypto_packets_as_termination_packets_(false), |
silent_close_enabled_(false), |
+ close_connection_after_five_rtos_(false), |
received_packet_manager_(&stats_), |
ack_queued_(false), |
num_retransmittable_packets_received_since_last_ack_sent_(0), |
@@ -370,6 +371,10 @@ void QuicConnection::SetFromConfig(const QuicConfig& config) { |
config.HasClientSentConnectionOption(kAKD2, perspective_)) { |
ack_mode_ = ACK_DECIMATION_WITH_REORDERING; |
} |
+ if (FLAGS_quic_enable_rto_timeout && |
+ config.HasClientSentConnectionOption(k5RTO, perspective_)) { |
+ close_connection_after_five_rtos_ = true; |
+ } |
} |
void QuicConnection::OnSendConnectionState( |
@@ -1782,6 +1787,14 @@ void QuicConnection::OnRetransmissionTimeout() { |
return; |
} |
+ if (close_connection_after_five_rtos_ && |
+ sent_packet_manager_.consecutive_rto_count() >= 4) { |
+ // Close on the 5th consecutive RTO, so after 4 previous RTOs have occurred. |
+ SendConnectionCloseWithDetails(QUIC_TOO_MANY_RTOS, |
+ "5 consecutive retransmission timeouts"); |
+ return; |
+ } |
+ |
sent_packet_manager_.OnRetransmissionTimeout(); |
WriteIfNotBlocked(); |