Deprecate gfe2_reloadable_flag_quic_use_blackhole_detector. PiperOrigin-RevId: 311194400 Change-Id: Ic226fc5db820eaa387c6536bd01b8d28b3aa5cc3
diff --git a/quic/core/quic_arena_scoped_ptr_test.cc b/quic/core/quic_arena_scoped_ptr_test.cc index cd0780f..5b7548a 100644 --- a/quic/core/quic_arena_scoped_ptr_test.cc +++ b/quic/core/quic_arena_scoped_ptr_test.cc
@@ -13,7 +13,7 @@ enum class TestParam { kFromHeap, kFromArena }; struct TestObject { - explicit TestObject(uintptr_t value) : value(value) { buffer.resize(1200); } + explicit TestObject(uintptr_t value) : value(value) { buffer.resize(1024); } uintptr_t value; // Ensure that we have a non-trivial destructor that will leak memory if it's @@ -51,7 +51,7 @@ } private: - QuicOneBlockArena<1200> arena_; + QuicOneBlockArena<1024> arena_; }; INSTANTIATE_TEST_SUITE_P(QuicArenaScopedPtrParamTest, @@ -69,7 +69,7 @@ } TEST_P(QuicArenaScopedPtrParamTest, FromArena) { - QuicOneBlockArena<1200> arena_; + QuicOneBlockArena<1024> arena_; EXPECT_TRUE(arena_.New<TestObject>(0).is_from_arena()); EXPECT_FALSE( QuicArenaScopedPtr<TestObject>(new TestObject(0)).is_from_arena());
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index 32d3edd..61119ad 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -286,9 +286,6 @@ mtu_discovery_alarm_(alarm_factory_->CreateAlarm( arena_.New<MtuDiscoveryAlarmDelegate>(this), &arena_)), - path_degrading_alarm_(alarm_factory_->CreateAlarm( - arena_.New<PathDegradingAlarmDelegate>(this), - &arena_)), process_undecryptable_packets_alarm_(alarm_factory_->CreateAlarm( arena_.New<ProcessUndecryptablePacketsAlarmDelegate>(this), &arena_)), @@ -2460,22 +2457,15 @@ !is_termination_packet) { // Start blackhole/path degrading detections if the sent packet is not // termination packet and contains retransmittable data. - if (use_blackhole_detector_) { - // Do not restart detection if detection is in progress indicating no - // forward progress has been made since last event (i.e., packet was sent - // or new packets were acknowledged). - if (!blackhole_detector_.IsDetectionInProgress()) { - // Try to start detections if no detection in progress. This could - // because either both detections are inactive when sending last packet - // or this connection just gets out of quiescence. - QUIC_RELOADABLE_FLAG_COUNT_N(quic_use_blackhole_detector, 1, 4); - blackhole_detector_.RestartDetection(GetPathDegradingDeadline(), - GetNetworkBlackholeDeadline()); - } - } else if (!is_path_degrading_ && !path_degrading_alarm_->IsSet()) { - // This is the first retransmittable packet on the working path. - // Start the path degrading alarm to detect new path degrading. - SetPathDegradingAlarm(); + // Do not restart detection if detection is in progress indicating no + // forward progress has been made since last event (i.e., packet was sent + // or new packets were acknowledged). + if (!blackhole_detector_.IsDetectionInProgress()) { + // Try to start detections if no detection in progress. This could + // because either both detections are inactive when sending last packet + // or this connection just gets out of quiescence. + blackhole_detector_.RestartDetection(GetPathDegradingDeadline(), + GetNetworkBlackholeDeadline()); } if (use_idle_network_detector_) { @@ -2777,28 +2767,6 @@ QuicPacketNumber previous_created_packet_number = packet_creator_.packet_number(); - if (!use_blackhole_detector_) { - if (close_connection_after_five_rtos_ && - sent_packet_manager_.GetConsecutiveRtoCount() >= 4) { - // Close on the 5th consecutive RTO, so after 4 previous RTOs have - // occurred. - CloseConnection(QUIC_TOO_MANY_RTOS, - "5 consecutive retransmission timeouts", - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); - return; - } - if (sent_packet_manager_.pto_enabled() && max_consecutive_ptos_ > 0 && - sent_packet_manager_.GetConsecutivePtoCount() >= - max_consecutive_ptos_) { - CloseConnection( - QUIC_TOO_MANY_RTOS, - quiche::QuicheStrCat(max_consecutive_ptos_ + 1, - "consecutive retransmission timeouts"), - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); - return; - } - } - const auto retransmission_mode = sent_packet_manager_.OnRetransmissionTimeout(); if (sent_packet_manager_.skip_packet_number_for_pto() && @@ -3173,12 +3141,8 @@ send_alarm_->Cancel(); timeout_alarm_->Cancel(); mtu_discovery_alarm_->Cancel(); - path_degrading_alarm_->Cancel(); process_undecryptable_packets_alarm_->Cancel(); - if (use_blackhole_detector_) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_use_blackhole_detector, 4, 4); - blackhole_detector_.StopDetection(); - } + blackhole_detector_.StopDetection(); if (use_idle_network_detector_) { QUIC_RELOADABLE_FLAG_COUNT_N(quic_use_idle_network_detector, 3, 6); idle_network_detector_.StopDetection(); @@ -3379,16 +3343,6 @@ kAlarmGranularity); } -void QuicConnection::SetPathDegradingAlarm() { - DCHECK(!use_blackhole_detector_); - if (perspective_ == Perspective::IS_SERVER) { - return; - } - const QuicTime::Delta delay = sent_packet_manager_.GetPathDegradingDelay(); - path_degrading_alarm_->Update(clock_->ApproximateNow() + delay, - kAlarmGranularity); -} - void QuicConnection::MaybeSetMtuAlarm(QuicPacketNumber sent_packet_number) { if (mtu_discovery_alarm_->IsSet() || !mtu_discoverer_.ShouldProbeMtu(sent_packet_number)) { @@ -3912,22 +3866,16 @@ // Always reset the retransmission alarm when an ack comes in, since we now // have a better estimate of the current rtt than when it was set. SetRetransmissionAlarm(); - if (use_blackhole_detector_) { - if (acked_new_packet) { - is_path_degrading_ = false; - if (sent_packet_manager_.HasInFlightPackets()) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_use_blackhole_detector, 2, 4); - // Restart detections if forward progress has been made. - blackhole_detector_.RestartDetection(GetPathDegradingDeadline(), - GetNetworkBlackholeDeadline()); - } else { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_use_blackhole_detector, 3, 4); - // Stop detections in quiecense. - blackhole_detector_.StopDetection(); - } + if (acked_new_packet) { + is_path_degrading_ = false; + if (sent_packet_manager_.HasInFlightPackets()) { + // Restart detections if forward progress has been made. + blackhole_detector_.RestartDetection(GetPathDegradingDeadline(), + GetNetworkBlackholeDeadline()); + } else { + // Stop detections in quiecense. + blackhole_detector_.StopDetection(); } - } else { - MaybeSetPathDegradingAlarm(acked_new_packet); } if (send_stop_waiting) { @@ -3937,21 +3885,6 @@ } } -void QuicConnection::MaybeSetPathDegradingAlarm(bool acked_new_packet) { - DCHECK(!use_blackhole_detector_); - if (!sent_packet_manager_.HasInFlightPackets()) { - // There are no retransmittable packets on the wire, so it's impossible to - // say if the connection has degraded. - path_degrading_alarm_->Cancel(); - } else if (acked_new_packet) { - // A previously-unacked packet has been acked, which means forward progress - // has been made. Unset |is_path_degrading| if the path was considered as - // degrading previously. Set/update the path degrading alarm. - is_path_degrading_ = false; - SetPathDegradingAlarm(); - } -} - void QuicConnection::SetSessionNotifier( SessionNotifierInterface* session_notifier) { sent_packet_manager_.SetSessionNotifier(session_notifier); @@ -4326,13 +4259,11 @@ } void QuicConnection::OnPathDegradingDetected() { - DCHECK(use_blackhole_detector_); is_path_degrading_ = true; visitor_->OnPathDegrading(); } void QuicConnection::OnBlackholeDetected() { - DCHECK(use_blackhole_detector_); CloseConnection(QUIC_TOO_MANY_RTOS, "Network blackhole detected.", ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); } @@ -4387,7 +4318,6 @@ } QuicTime QuicConnection::GetPathDegradingDeadline() const { - DCHECK(use_blackhole_detector_); if (!ShouldDetectPathDegrading()) { return QuicTime::Zero(); } @@ -4396,7 +4326,6 @@ } bool QuicConnection::ShouldDetectPathDegrading() const { - DCHECK(use_blackhole_detector_); if (!connected_) { return false; } @@ -4408,7 +4337,6 @@ } QuicTime QuicConnection::GetNetworkBlackholeDeadline() const { - DCHECK(use_blackhole_detector_); if (!ShouldDetectBlackhole()) { return QuicTime::Zero(); } @@ -4417,7 +4345,6 @@ } bool QuicConnection::ShouldDetectBlackhole() const { - DCHECK(use_blackhole_detector_); if (!connected_) { return false; }
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index 46031f3..08f44ff 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -1152,9 +1152,6 @@ // Sets the retransmission alarm based on SentPacketManager. void SetRetransmissionAlarm(); - // Sets the path degrading alarm. - void SetPathDegradingAlarm(); - // Sets the MTU discovery alarm if necessary. // |sent_packet_number| is the recently sent packet number. void MaybeSetMtuAlarm(QuicPacketNumber sent_packet_number); @@ -1197,10 +1194,6 @@ // |acked_new_packet| is true if a previously-unacked packet was acked. void PostProcessAfterAckFrame(bool send_stop_waiting, bool acked_new_packet); - // Called when an ACK is received to set the path degrading alarm or - // retransmittable on wire alarm. - void MaybeSetPathDegradingAlarm(bool acked_new_packet); - // Updates the release time into the future. void UpdateReleaseTimeIntoFuture(); @@ -1448,10 +1441,6 @@ QuicArenaScopedPtr<QuicAlarm> ping_alarm_; // An alarm that fires when an MTU probe should be sent. QuicArenaScopedPtr<QuicAlarm> mtu_discovery_alarm_; - // An alarm that fires when this connection is considered degrading. - // TODO(fayang): Remove this when deprecating quic_use_blackhole_detector - // flag. - QuicArenaScopedPtr<QuicAlarm> path_degrading_alarm_; // An alarm that fires to process undecryptable packets when new decyrption // keys are available. QuicArenaScopedPtr<QuicAlarm> process_undecryptable_packets_alarm_; @@ -1655,11 +1644,7 @@ QuicIdleNetworkDetector idle_network_detector_; - const bool use_blackhole_detector_ = - GetQuicReloadableFlag(quic_use_blackhole_detector); - const bool use_idle_network_detector_ = - use_blackhole_detector_ && GetQuicReloadableFlag(quic_use_idle_network_detector); const bool extend_idle_time_on_decryptable_packets_ =
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc index eb698a4..e9165b2 100644 --- a/quic/core/quic_connection_test.cc +++ b/quic/core/quic_connection_test.cc
@@ -845,8 +845,7 @@ } TestAlarmFactory::TestAlarm* GetTimeoutAlarm() { - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { return reinterpret_cast<TestAlarmFactory::TestAlarm*>( QuicConnectionPeer::GetIdleNetworkDetectorAlarm(this)); } @@ -859,40 +858,26 @@ QuicConnectionPeer::GetMtuDiscoveryAlarm(this)); } - TestAlarmFactory::TestAlarm* GetPathDegradingAlarm() { - return reinterpret_cast<TestAlarmFactory::TestAlarm*>( - QuicConnectionPeer::GetPathDegradingAlarm(this)); - } - TestAlarmFactory::TestAlarm* GetProcessUndecryptablePacketsAlarm() { return reinterpret_cast<TestAlarmFactory::TestAlarm*>( QuicConnectionPeer::GetProcessUndecryptablePacketsAlarm(this)); } TestAlarmFactory::TestAlarm* GetBlackholeDetectorAlarm() { - DCHECK(GetQuicReloadableFlag(quic_use_blackhole_detector)); return reinterpret_cast<TestAlarmFactory::TestAlarm*>( QuicConnectionPeer::GetBlackholeDetectorAlarm(this)); } void PathDegradingTimeout() { DCHECK(PathDegradingDetectionInProgress()); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - GetBlackholeDetectorAlarm()->Fire(); - } else { - GetPathDegradingAlarm()->Fire(); - } + GetBlackholeDetectorAlarm()->Fire(); } bool PathDegradingDetectionInProgress() { - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - return QuicConnectionPeer::GetPathDegradingDeadline(this).IsInitialized(); - } - return GetPathDegradingAlarm()->IsSet(); + return QuicConnectionPeer::GetPathDegradingDeadline(this).IsInitialized(); } bool BlackholeDetectionInProgress() { - DCHECK(GetQuicReloadableFlag(quic_use_blackhole_detector)); return QuicConnectionPeer::GetBlackholeDetectionDeadline(this) .IsInitialized(); } @@ -4795,8 +4780,7 @@ EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(0); QuicTime::Delta delay = initial_ddl - clock_.ApproximateNow(); clock_.AdvanceTime(delay); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { connection_.GetTimeoutAlarm()->Fire(); } // Verify the timeout alarm deadline is updated. @@ -4887,8 +4871,7 @@ EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); ProcessAckPacket(&frame); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { // Fire early to verify it wouldn't timeout yet. connection_.GetTimeoutAlarm()->Fire(); } @@ -5633,8 +5616,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 0, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -5647,8 +5629,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 3, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -5659,8 +5640,7 @@ // network event at t=5ms. The alarm will reregister. clock_.AdvanceTime(initial_idle_timeout - five_ms - five_ms); EXPECT_EQ(default_timeout, clock_.ApproximateNow()); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { connection_.GetTimeoutAlarm()->Fire(); } EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); @@ -5710,8 +5690,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 0, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -5745,8 +5724,7 @@ ASSERT_EQ(default_timeout.ToDebuggingValue(), clock_.Now().ToDebuggingValue()); EXPECT_EQ(default_timeout, clock_.Now()); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { connection_.GetTimeoutAlarm()->Fire(); } EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); @@ -5802,8 +5780,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 0, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -5816,8 +5793,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 3, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -5828,8 +5804,7 @@ // network event at t=5ms. The alarm will reregister. clock_.AdvanceTime(default_idle_timeout - five_ms - five_ms); EXPECT_EQ(default_timeout, clock_.ApproximateNow()); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { connection_.GetTimeoutAlarm()->Fire(); } EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); @@ -5891,8 +5866,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 0, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -5952,8 +5926,7 @@ SendStreamDataToPeer( GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo", 0, FIN, nullptr); - if (GetQuicReloadableFlag(quic_use_blackhole_detector) && - GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (GetQuicReloadableFlag(quic_use_idle_network_detector)) { EXPECT_EQ(default_timeout + five_ms, connection_.GetTimeoutAlarm()->deadline()); } else { @@ -6008,8 +5981,7 @@ // network event at t=5ms. The alarm will reregister. clock_.AdvanceTime(initial_idle_timeout - five_ms); EXPECT_EQ(default_timeout, clock_.ApproximateNow()); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { connection_.GetTimeoutAlarm()->Fire(); } EXPECT_TRUE(connection_.connected()); @@ -6067,8 +6039,7 @@ // network event at t=5ms. The alarm will reregister. clock_.AdvanceTime(initial_idle_timeout - five_ms); EXPECT_EQ(default_timeout, clock_.ApproximateNow()); - if (!GetQuicReloadableFlag(quic_use_blackhole_detector) || - !GetQuicReloadableFlag(quic_use_idle_network_detector)) { + if (!GetQuicReloadableFlag(quic_use_idle_network_detector)) { connection_.GetTimeoutAlarm()->Fire(); } EXPECT_TRUE(connection_.connected()); @@ -6120,10 +6091,8 @@ EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_TRUE(connection_.connected()); } - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_CALL(visitor_, OnPathDegrading()); - connection_.PathDegradingTimeout(); - } + EXPECT_CALL(visitor_, OnPathDegrading()); + connection_.PathDegradingTimeout(); EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveTlpCount()); EXPECT_EQ(4u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); @@ -6131,12 +6100,8 @@ EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF)); EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1)); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); - connection_.GetBlackholeDetectorAlarm()->Fire(); - } else { - connection_.GetRetransmissionAlarm()->Fire(); - } + ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); + connection_.GetBlackholeDetectorAlarm()->Fire(); EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_FALSE(connection_.connected()); TestConnectionCloseQuicErrorCode(QUIC_TOO_MANY_RTOS); @@ -7886,13 +7851,8 @@ EXPECT_FALSE(connection_.IsPathDegrading()); QuicTime::Delta delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); // Fire the path degrading alarm, path degrading signal should be sent to // the visitor. @@ -7925,33 +7885,22 @@ QuicTime::Delta delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); // Send a second packet. The path degrading alarm's deadline should remain // the same. // Regression test for b/69979024. clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); - QuicTime prev_deadline = connection_.GetPathDegradingAlarm()->deadline(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - prev_deadline = connection_.GetBlackholeDetectorAlarm()->deadline(); - } + QuicTime prev_deadline = + connection_.GetBlackholeDetectorAlarm()->deadline(); connection_.SendStreamDataWithString( GetNthClientInitiatedStreamId(1, connection_.transport_version()), data, offset, NO_FIN); offset += data_size; EXPECT_TRUE(connection_.PathDegradingDetectionInProgress()); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(prev_deadline, - connection_.GetBlackholeDetectorAlarm()->deadline()); - } else { - EXPECT_EQ(prev_deadline, connection_.GetPathDegradingAlarm()->deadline()); - } + EXPECT_EQ(prev_deadline, + connection_.GetBlackholeDetectorAlarm()->deadline()); // Now receive an ACK of the first packet. This should advance the path // degrading alarm's deadline since forward progress has been made. @@ -7967,13 +7916,8 @@ // Check the deadline of the path degrading alarm. delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); if (i == 0) { // Now receive an ACK of the second packet. Since there are no more @@ -8023,13 +7967,8 @@ EXPECT_TRUE(connection_.PathDegradingDetectionInProgress()); QuicTime::Delta delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); ASSERT_TRUE(connection_.sent_packet_manager().HasInFlightPackets()); // The ping alarm is set for the ping timeout, not the shorter // retransmittable_on_wire_timeout. @@ -8065,13 +8004,8 @@ EXPECT_TRUE(connection_.PathDegradingDetectionInProgress()); delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); } // This test verifies that the connection marks path as degrading and does not @@ -8094,30 +8028,17 @@ // Check the deadline of the path degrading alarm. QuicTime::Delta delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); // Send a second packet. The path degrading alarm's deadline should remain // the same. clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); - QuicTime prev_deadline = connection_.GetPathDegradingAlarm()->deadline(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - prev_deadline = connection_.GetBlackholeDetectorAlarm()->deadline(); - } + QuicTime prev_deadline = connection_.GetBlackholeDetectorAlarm()->deadline(); connection_.SendStreamDataWithString(1, data, offset, NO_FIN); offset += data_size; EXPECT_TRUE(connection_.PathDegradingDetectionInProgress()); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(prev_deadline, - connection_.GetBlackholeDetectorAlarm()->deadline()); - } else { - EXPECT_EQ(prev_deadline, connection_.GetPathDegradingAlarm()->deadline()); - } + EXPECT_EQ(prev_deadline, connection_.GetBlackholeDetectorAlarm()->deadline()); // Now receive an ACK of the first packet. This should advance the path // degrading alarm's deadline since forward progress has been made. @@ -8131,13 +8052,8 @@ // Check the deadline of the path degrading alarm. delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); // Advance time to the path degrading alarm's deadline and simulate // firing the path degrading alarm. This path will be considered as @@ -8178,30 +8094,17 @@ // Check the deadline of the path degrading alarm. QuicTime::Delta delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); // Send a second packet. The path degrading alarm's deadline should remain // the same. clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); - QuicTime prev_deadline = connection_.GetPathDegradingAlarm()->deadline(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - prev_deadline = connection_.GetBlackholeDetectorAlarm()->deadline(); - } + QuicTime prev_deadline = connection_.GetBlackholeDetectorAlarm()->deadline(); connection_.SendStreamDataWithString(1, data, offset, NO_FIN); offset += data_size; EXPECT_TRUE(connection_.PathDegradingDetectionInProgress()); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(prev_deadline, - connection_.GetBlackholeDetectorAlarm()->deadline()); - } else { - EXPECT_EQ(prev_deadline, connection_.GetPathDegradingAlarm()->deadline()); - } + EXPECT_EQ(prev_deadline, connection_.GetBlackholeDetectorAlarm()->deadline()); // Now receive an ACK of the first packet. This should advance the path // degrading alarm's deadline since forward progress has been made. @@ -8215,13 +8118,8 @@ // Check the deadline of the path degrading alarm. delay = QuicConnectionPeer::GetSentPacketManager(&connection_) ->GetPathDegradingDelay(); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - - clock_.ApproximateNow()); - } else { - EXPECT_EQ(delay, connection_.GetPathDegradingAlarm()->deadline() - - clock_.ApproximateNow()); - } + EXPECT_EQ(delay, connection_.GetBlackholeDetectorAlarm()->deadline() - + clock_.ApproximateNow()); // Advance time to the path degrading alarm's deadline and simulate // firing the alarm. @@ -9988,10 +9886,8 @@ EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_TRUE(connection_.connected()); } - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_CALL(visitor_, OnPathDegrading()); - connection_.PathDegradingTimeout(); - } + EXPECT_CALL(visitor_, OnPathDegrading()); + connection_.PathDegradingTimeout(); EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveTlpCount()); EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); @@ -10001,12 +9897,8 @@ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1)); EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF)); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); - connection_.GetBlackholeDetectorAlarm()->Fire(); - } else { - connection_.GetRetransmissionAlarm()->Fire(); - } + ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); + connection_.GetBlackholeDetectorAlarm()->Fire(); EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_FALSE(connection_.connected()); TestConnectionCloseQuicErrorCode(QUIC_TOO_MANY_RTOS); @@ -10035,10 +9927,8 @@ EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_TRUE(connection_.connected()); } - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_CALL(visitor_, OnPathDegrading()); - connection_.PathDegradingTimeout(); - } + EXPECT_CALL(visitor_, OnPathDegrading()); + connection_.PathDegradingTimeout(); EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveTlpCount()); EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); @@ -10047,12 +9937,8 @@ EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF)); EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1)); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); - connection_.GetBlackholeDetectorAlarm()->Fire(); - } else { - connection_.GetRetransmissionAlarm()->Fire(); - } + ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); + connection_.GetBlackholeDetectorAlarm()->Fire(); EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_FALSE(connection_.connected()); TestConnectionCloseQuicErrorCode(QUIC_TOO_MANY_RTOS); @@ -10081,10 +9967,8 @@ EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_TRUE(connection_.connected()); } - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - EXPECT_CALL(visitor_, OnPathDegrading()); - connection_.PathDegradingTimeout(); - } + EXPECT_CALL(visitor_, OnPathDegrading()); + connection_.PathDegradingTimeout(); EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveTlpCount()); EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); @@ -10093,12 +9977,8 @@ EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF)); EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1)); - if (GetQuicReloadableFlag(quic_use_blackhole_detector)) { - ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); - connection_.GetBlackholeDetectorAlarm()->Fire(); - } else { - connection_.GetRetransmissionAlarm()->Fire(); - } + ASSERT_TRUE(connection_.BlackholeDetectionInProgress()); + connection_.GetBlackholeDetectorAlarm()->Fire(); EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); EXPECT_FALSE(connection_.connected()); TestConnectionCloseQuicErrorCode(QUIC_TOO_MANY_RTOS); @@ -10749,8 +10629,7 @@ peer_framer_.SetEncrypter(ENCRYPTION_FORWARD_SECURE, std::make_unique<TaggingEncrypter>(tag)); ProcessDataPacketAtLevel(1, !kHasStopWaiting, ENCRYPTION_FORWARD_SECURE); - if (GetQuicReloadableFlag(quic_extend_idle_time_on_decryptable_packets) || - !GetQuicReloadableFlag(quic_use_blackhole_detector)) { + if (GetQuicReloadableFlag(quic_extend_idle_time_on_decryptable_packets)) { // Verify deadline does not get extended. EXPECT_EQ(initial_deadline, connection_.GetTimeoutAlarm()->deadline()); } @@ -10761,8 +10640,7 @@ } QuicTime::Delta delay = initial_deadline - clock_.ApproximateNow(); clock_.AdvanceTime(delay); - if (GetQuicReloadableFlag(quic_extend_idle_time_on_decryptable_packets) || - !GetQuicReloadableFlag(quic_use_blackhole_detector)) { + if (GetQuicReloadableFlag(quic_extend_idle_time_on_decryptable_packets)) { connection_.GetTimeoutAlarm()->Fire(); } if (GetQuicReloadableFlag(quic_extend_idle_time_on_decryptable_packets)) {
diff --git a/quic/core/quic_one_block_arena.h b/quic/core/quic_one_block_arena.h index d6b7ee9..41842f3 100644 --- a/quic/core/quic_one_block_arena.h +++ b/quic/core/quic_one_block_arena.h
@@ -75,10 +75,7 @@ // QuicConnections currently use around 1KB of polymorphic types which would // ordinarily be on the heap. Instead, store them inline in an arena. -// TODO(fayang): Switch this and 1200 used in quic_arena_scoped_ptr_test and -// quic_one_block_arena_test back to 1024 when deprecating -// quic_use_blackhole_detector or quic_use_idle_network_detector. -using QuicConnectionArena = QuicOneBlockArena<1200>; +using QuicConnectionArena = QuicOneBlockArena<1024>; } // namespace quic
diff --git a/quic/core/quic_one_block_arena_test.cc b/quic/core/quic_one_block_arena_test.cc index 11b12de..3175ac5 100644 --- a/quic/core/quic_one_block_arena_test.cc +++ b/quic/core/quic_one_block_arena_test.cc
@@ -23,14 +23,14 @@ class QuicOneBlockArenaTest : public QuicTest {}; TEST_F(QuicOneBlockArenaTest, AllocateSuccess) { - QuicOneBlockArena<1200> arena; + QuicOneBlockArena<1024> arena; QuicArenaScopedPtr<TestObject> ptr = arena.New<TestObject>(); EXPECT_TRUE(ptr.is_from_arena()); } TEST_F(QuicOneBlockArenaTest, Exhaust) { - QuicOneBlockArena<1200> arena; - for (size_t i = 0; i < 1200 / kMaxAlign; ++i) { + QuicOneBlockArena<1024> arena; + for (size_t i = 0; i < 1024 / kMaxAlign; ++i) { QuicArenaScopedPtr<TestObject> ptr = arena.New<TestObject>(); EXPECT_TRUE(ptr.is_from_arena()); } @@ -41,10 +41,10 @@ } TEST_F(QuicOneBlockArenaTest, NoOverlaps) { - QuicOneBlockArena<1200> arena; + QuicOneBlockArena<1024> arena; std::vector<QuicArenaScopedPtr<TestObject>> objects; QuicIntervalSet<uintptr_t> used; - for (size_t i = 0; i < 1200 / kMaxAlign; ++i) { + for (size_t i = 0; i < 1024 / kMaxAlign; ++i) { QuicArenaScopedPtr<TestObject> ptr = arena.New<TestObject>(); EXPECT_TRUE(ptr.is_from_arena());
diff --git a/quic/test_tools/quic_connection_peer.cc b/quic/test_tools/quic_connection_peer.cc index 09dff83..d276f63 100644 --- a/quic/test_tools/quic_connection_peer.cc +++ b/quic/test_tools/quic_connection_peer.cc
@@ -154,12 +154,6 @@ } // static -QuicAlarm* QuicConnectionPeer::GetPathDegradingAlarm( - QuicConnection* connection) { - return connection->path_degrading_alarm_.get(); -} - -// static QuicAlarm* QuicConnectionPeer::GetProcessUndecryptablePacketsAlarm( QuicConnection* connection) { return connection->process_undecryptable_packets_alarm_.get();
diff --git a/quic/test_tools/quic_connection_peer.h b/quic/test_tools/quic_connection_peer.h index b66a8a2..9882f62 100644 --- a/quic/test_tools/quic_connection_peer.h +++ b/quic/test_tools/quic_connection_peer.h
@@ -81,7 +81,6 @@ static QuicAlarm* GetSendAlarm(QuicConnection* connection); static QuicAlarm* GetTimeoutAlarm(QuicConnection* connection); static QuicAlarm* GetMtuDiscoveryAlarm(QuicConnection* connection); - static QuicAlarm* GetPathDegradingAlarm(QuicConnection* connection); static QuicAlarm* GetProcessUndecryptablePacketsAlarm( QuicConnection* connection);