Deprecate --gfe2_restart_flag_quic_dispatcher_ack_buffered_initial_packets.

PiperOrigin-RevId: 689086295
diff --git a/quiche/common/quiche_feature_flags_list.h b/quiche/common/quiche_feature_flags_list.h
index 3cf6f59..01097c8 100755
--- a/quiche/common/quiche_feature_flags_list.h
+++ b/quiche/common/quiche_feature_flags_list.h
@@ -54,7 +54,6 @@
 QUICHE_FLAG(bool, quiche_reloadable_flag_quic_testonly_default_false, false, false, "A testonly reloadable flag that will always default to false.")
 QUICHE_FLAG(bool, quiche_reloadable_flag_quic_testonly_default_true, true, true, "A testonly reloadable flag that will always default to true.")
 QUICHE_FLAG(bool, quiche_reloadable_flag_quic_use_received_client_addresses_cache, true, true, "If true, use a LRU cache to record client addresses of packets received on server's original address.")
-QUICHE_FLAG(bool, quiche_restart_flag_quic_dispatcher_ack_buffered_initial_packets, true, true, "If both this flag and --quic_dispatcher_replace_cid_on_first_packet are true, QUIC dispatcher will ack INITIAL packets once it is saved into buffered packet store.")
 QUICHE_FLAG(bool, quiche_restart_flag_quic_support_ect1, false, false, "When true, allows sending of QUIC packets marked ECT(1). A different flag (TBD) will actually utilize this capability to send ECT(1).")
 QUICHE_FLAG(bool, quiche_restart_flag_quic_support_flow_label, false, false, "If true, QUIC will support reading and writing IPv6 flow labels.")
 QUICHE_FLAG(bool, quiche_restart_flag_quic_support_release_time_for_gso, false, false, "If true, QuicGsoBatchWriter will support release time if it is available and the process has the permission to do so.")
diff --git a/quiche/quic/core/http/end_to_end_test.cc b/quiche/quic/core/http/end_to_end_test.cc
index 06f2bcb..cb49bcb 100644
--- a/quiche/quic/core/http/end_to_end_test.cc
+++ b/quiche/quic/core/http/end_to_end_test.cc
@@ -307,10 +307,6 @@
     return client;
   }
 
-  bool DispatcherAckEnabled() const {
-    return GetQuicRestartFlag(quic_dispatcher_ack_buffered_initial_packets);
-  }
-
   void set_smaller_flow_control_receive_window() {
     const uint32_t kClientIFCW = 64 * 1024;
     const uint32_t kServerIFCW = 1024 * 1024;
@@ -1223,7 +1219,7 @@
   ASSERT_NE(server_connection, nullptr);
   const QuicConnectionStats& server_stats = server_connection->GetStats();
 
-  if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+  if (version_ != ParsedQuicVersion::RFCv2()) {
     EXPECT_EQ(server_stats.packets_sent_by_dispatcher, 1u);
   } else {
     EXPECT_EQ(server_stats.packets_sent_by_dispatcher, 0u);
@@ -1235,7 +1231,7 @@
   EXPECT_EQ(dispatcher_stats.packets_enqueued_early, 1u);
   EXPECT_EQ(dispatcher_stats.packets_enqueued_chlo, 0u);
 
-  if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+  if (version_ != ParsedQuicVersion::RFCv2()) {
     EXPECT_EQ(dispatcher_stats.packets_sent, 1u);
   } else {
     EXPECT_EQ(dispatcher_stats.packets_sent, 0u);
@@ -1274,7 +1270,7 @@
     const QuicDispatcherStats& dispatcher_stats = GetDispatcherStats();
     EXPECT_EQ(dispatcher_stats.sessions_created, 1u);
 
-    if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+    if (version_ != ParsedQuicVersion::RFCv2()) {
       // 2 CHLO packets are enqueued, but only the 1st caused a dispatcher ACK.
       EXPECT_EQ(dispatcher_stats.packets_sent, 1u);
       EXPECT_EQ(dispatcher_stats.packets_processed_with_unknown_cid, 2u);
@@ -1332,7 +1328,7 @@
     EXPECT_EQ(dispatcher_stats.packets_enqueued_early, 1u);
     EXPECT_EQ(dispatcher_stats.packets_processed_with_unknown_cid, 2u);
 
-    if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+    if (version_ != ParsedQuicVersion::RFCv2()) {
       // 2 CHLO packets are enqueued, but only the 1st caused a dispatcher ACK.
       EXPECT_EQ(dispatcher_stats.packets_sent, 1u);
     } else {
@@ -1370,7 +1366,7 @@
   ASSERT_NE(server_connection, nullptr);
   const QuicConnectionStats& server_stats = server_connection->GetStats();
 
-  if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+  if (version_ != ParsedQuicVersion::RFCv2()) {
     EXPECT_EQ(server_stats.packets_sent_by_dispatcher, 2u);
   } else {
     EXPECT_EQ(server_stats.packets_sent_by_dispatcher, 0u);
@@ -1383,7 +1379,7 @@
   EXPECT_EQ(dispatcher_stats.packets_enqueued_early, 2u);
   EXPECT_EQ(dispatcher_stats.packets_enqueued_chlo, 0u);
 
-  if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+  if (version_ != ParsedQuicVersion::RFCv2()) {
     EXPECT_EQ(dispatcher_stats.packets_sent, 2u);
   } else {
     EXPECT_EQ(dispatcher_stats.packets_sent, 0u);
@@ -1417,7 +1413,7 @@
   ASSERT_NE(server_connection, nullptr);
   const QuicConnectionStats& server_stats = server_connection->GetStats();
 
-  if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+  if (version_ != ParsedQuicVersion::RFCv2()) {
     EXPECT_EQ(server_stats.packets_sent_by_dispatcher, 1u);
   } else {
     EXPECT_EQ(server_stats.packets_sent_by_dispatcher, 0u);
@@ -1430,7 +1426,7 @@
   EXPECT_EQ(dispatcher_stats.packets_enqueued_early, 2u);
   EXPECT_EQ(dispatcher_stats.packets_enqueued_chlo, 0u);
 
-  if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+  if (version_ != ParsedQuicVersion::RFCv2()) {
     EXPECT_EQ(dispatcher_stats.packets_sent, 1u);
   } else {
     EXPECT_EQ(dispatcher_stats.packets_sent, 0u);
@@ -1469,7 +1465,7 @@
     const QuicDispatcherStats& dispatcher_stats = GetDispatcherStats();
     EXPECT_EQ(dispatcher_stats.sessions_created, 1u);
 
-    if (DispatcherAckEnabled() && version_ != ParsedQuicVersion::RFCv2()) {
+    if (version_ != ParsedQuicVersion::RFCv2()) {
       // Packet 1 and Packet 2's retransmission caused dispatcher ACKs.
       EXPECT_EQ(dispatcher_stats.packets_sent, 2u);
       EXPECT_EQ(dispatcher_stats.packets_processed_with_unknown_cid, 3u);
diff --git a/quiche/quic/core/quic_buffered_packet_store.cc b/quiche/quic/core/quic_buffered_packet_store.cc
index bec282b..c881588 100644
--- a/quiche/quic/core/quic_buffered_packet_store.cc
+++ b/quiche/quic/core/quic_buffered_packet_store.cc
@@ -242,11 +242,6 @@
 
 void QuicBufferedPacketStore::MaybeAckInitialPacket(
     const ReceivedPacketInfo& packet_info, BufferedPacketList& packet_list) {
-  if (!ack_buffered_initial_packets_) {
-    return;
-  }
-
-  QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 1, 8);
   if (writer_ == nullptr || writer_->IsWriteBlocked() ||
       !packet_info.version.IsKnown() ||
       !packet_list.HasAttemptedToReplaceConnectionId() ||
@@ -379,11 +374,6 @@
 
 const BufferedPacketList* QuicBufferedPacketStore::GetPacketList(
     const QuicConnectionId& connection_id) const {
-  if (!ack_buffered_initial_packets_) {
-    return nullptr;
-  }
-
-  QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 2, 8);
   auto it = buffered_session_map_.find(connection_id);
   if (it == buffered_session_map_.end()) {
     return nullptr;
diff --git a/quiche/quic/core/quic_buffered_packet_store.h b/quiche/quic/core/quic_buffered_packet_store.h
index 80ebbc1..c430757 100644
--- a/quiche/quic/core/quic_buffered_packet_store.h
+++ b/quiche/quic/core/quic_buffered_packet_store.h
@@ -268,10 +268,6 @@
   const BufferedPacketList* GetPacketList(
       const QuicConnectionId& connection_id) const;
 
-  bool ack_buffered_initial_packets() const {
-    return ack_buffered_initial_packets_;
-  }
-
  private:
   friend class test::QuicBufferedPacketStorePeer;
 
@@ -342,9 +338,6 @@
   // This alarm fires every |connection_life_span_| to clean up
   // packets staying in the store for too long.
   std::unique_ptr<QuicAlarm> expiration_alarm_;
-
-  const bool ack_buffered_initial_packets_ =
-      GetQuicRestartFlag(quic_dispatcher_ack_buffered_initial_packets);
 };
 
 // Collects packets serialized by a QuicPacketCreator.
diff --git a/quiche/quic/core/quic_dispatcher.cc b/quiche/quic/core/quic_dispatcher.cc
index 1ffb383..cfae92b 100644
--- a/quiche/quic/core/quic_dispatcher.cc
+++ b/quiche/quic/core/quic_dispatcher.cc
@@ -136,10 +136,6 @@
     // Always set encrypter with original_server_connection_id.
     framer_.SetInitialObfuscators(original_server_connection_id);
     if (last_sent_packet_number.IsInitialized()) {
-      QUICHE_DCHECK(
-          GetQuicRestartFlag(quic_dispatcher_ack_buffered_initial_packets));
-      QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 3,
-                                8);
       creator_.set_packet_number(last_sent_packet_number);
     }
   }
@@ -328,17 +324,13 @@
 #ifndef NDEBUG
   // Consult the buffered packet store to see if the packet's DCID is a replaced
   // cid generated by us, if so, increment a counter used only by tests.
-  if (ack_buffered_initial_packets()) {
-    const BufferedPacketList* packet_list =
-        buffered_packets_.GetPacketList(packet_info.destination_connection_id);
-    if (packet_list != nullptr &&
-        packet_list->replaced_connection_id.has_value() &&
-        *packet_list->replaced_connection_id ==
-            packet_info.destination_connection_id) {
-      QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 4,
-                                8);
-      ++stats_.packets_processed_with_replaced_cid_in_store;
-    }
+  const BufferedPacketList* packet_list =
+      buffered_packets_.GetPacketList(packet_info.destination_connection_id);
+  if (packet_list != nullptr &&
+      packet_list->replaced_connection_id.has_value() &&
+      *packet_list->replaced_connection_id ==
+          packet_info.destination_connection_id) {
+    ++stats_.packets_processed_with_replaced_cid_in_store;
   }
 #endif
 
@@ -1037,7 +1029,6 @@
     return;
   }
 
-  QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 5, 8);
   StatelesslyTerminateConnection(
       self_address, peer_address, packet_list->original_connection_id, format,
       version_flag, use_length_prefix, version, error_code, error_details,
@@ -1076,39 +1067,25 @@
                 ? replaced_connection_id->ToString()
                 : "n/a");
 
-    if (ack_buffered_initial_packets()) {
-      // |server_connection_id| is the original connection ID when flag is true.
-      QuicConnectionId original_connection_id = server_connection_id;
-      if (last_sent_packet_number.IsInitialized()) {
-        QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets,
-                                  6, 8);
-      }
+    // |server_connection_id| is the original connection ID when flag is true.
+    QuicConnectionId original_connection_id = server_connection_id;
 
-      StatelessConnectionTerminator terminator(
-          replaced_connection_id.value_or(original_connection_id),
-          original_connection_id, version, last_sent_packet_number,
-          helper_.get(), time_wait_list_manager_.get());
+    StatelessConnectionTerminator terminator(
+        replaced_connection_id.value_or(original_connection_id),
+        original_connection_id, version, last_sent_packet_number, helper_.get(),
+        time_wait_list_manager_.get());
 
-      std::vector<QuicConnectionId> active_connection_ids = {
-          original_connection_id};
-      if (replaced_connection_id.has_value()) {
-        active_connection_ids.push_back(*replaced_connection_id);
-      }
-      // This also adds the connection to time wait list.
-      terminator.CloseConnection(error_code, error_details,
-                                 format != GOOGLE_QUIC_PACKET,
-                                 /*active_connection_ids=*/
-                                 std::move(active_connection_ids));
-    } else {
-      StatelessConnectionTerminator terminator(
-          server_connection_id, server_connection_id, version,
-          last_sent_packet_number, helper_.get(),
-          time_wait_list_manager_.get());
-      // This also adds the connection to time wait list.
-      terminator.CloseConnection(
-          error_code, error_details, format != GOOGLE_QUIC_PACKET,
-          /*active_connection_ids=*/{server_connection_id});
+    std::vector<QuicConnectionId> active_connection_ids = {
+        original_connection_id};
+    if (replaced_connection_id.has_value()) {
+      active_connection_ids.push_back(*replaced_connection_id);
     }
+    // This also adds the connection to time wait list.
+    terminator.CloseConnection(error_code, error_details,
+                               format != GOOGLE_QUIC_PACKET,
+                               /*active_connection_ids=*/
+                               std::move(active_connection_ids));
+
     QUIC_CODE_COUNT(quic_dispatcher_generated_connection_close);
     QuicSession::RecordConnectionCloseAtServer(
         error_code, ConnectionCloseSource::FROM_SELF);
@@ -1146,7 +1123,7 @@
 // TODO(wub): Remove |server_connection_id| because |early_arrived_packets|
 // already contains the original and replaced connection ID.
 void QuicDispatcher::OnExpiredPackets(
-    QuicConnectionId server_connection_id,
+    QuicConnectionId /*server_connection_id*/,
     BufferedPacketList early_arrived_packets) {
   QUIC_CODE_COUNT(quic_reject_buffered_packets_expired);
   QuicErrorCode error_code = QUIC_HANDSHAKE_FAILED_PACKETS_BUFFERED_TOO_LONG;
@@ -1156,32 +1133,17 @@
     peer_address = early_arrived_packets.buffered_packets.front().peer_address;
   }
 
-  if (ack_buffered_initial_packets()) {
-    QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 7,
-                              8);
-    StatelesslyTerminateConnection(
-        self_address, peer_address,
-        early_arrived_packets.original_connection_id,
-        early_arrived_packets.ietf_quic ? IETF_QUIC_LONG_HEADER_PACKET
-                                        : GOOGLE_QUIC_PACKET,
-        /*version_flag=*/true,
-        early_arrived_packets.version.HasLengthPrefixedConnectionIds(),
-        early_arrived_packets.version, error_code,
-        "Packets buffered for too long",
-        quic::QuicTimeWaitListManager::SEND_STATELESS_RESET,
-        early_arrived_packets.replaced_connection_id,
-        early_arrived_packets.GetLastSentPacketNumber());
-  } else {
-    StatelesslyTerminateConnection(
-        self_address, peer_address, server_connection_id,
-        early_arrived_packets.ietf_quic ? IETF_QUIC_LONG_HEADER_PACKET
-                                        : GOOGLE_QUIC_PACKET,
-        /*version_flag=*/true,
-        early_arrived_packets.version.HasLengthPrefixedConnectionIds(),
-        early_arrived_packets.version, error_code,
-        "Packets buffered for too long",
-        quic::QuicTimeWaitListManager::SEND_STATELESS_RESET);
-  }
+  StatelesslyTerminateConnection(
+      self_address, peer_address, early_arrived_packets.original_connection_id,
+      early_arrived_packets.ietf_quic ? IETF_QUIC_LONG_HEADER_PACKET
+                                      : GOOGLE_QUIC_PACKET,
+      /*version_flag=*/true,
+      early_arrived_packets.version.HasLengthPrefixedConnectionIds(),
+      early_arrived_packets.version, error_code,
+      "Packets buffered for too long",
+      quic::QuicTimeWaitListManager::SEND_STATELESS_RESET,
+      early_arrived_packets.replaced_connection_id,
+      early_arrived_packets.GetLastSentPacketNumber());
 }
 
 void QuicDispatcher::ProcessBufferedChlos(size_t max_connections_to_create) {
@@ -1411,9 +1373,7 @@
   } else {
     QUIC_CODE_COUNT(quic_connection_created_single_packet_chlo);
   }
-  if (ack_buffered_initial_packets() && !dispatcher_sent_packets.empty()) {
-    QUIC_RESTART_FLAG_COUNT_N(quic_dispatcher_ack_buffered_initial_packets, 8,
-                              8);
+  if (!dispatcher_sent_packets.empty()) {
     session->connection()->AddDispatcherSentPackets(dispatcher_sent_packets);
   }
 
diff --git a/quiche/quic/core/quic_dispatcher.h b/quiche/quic/core/quic_dispatcher.h
index 7701a46..7678bbb 100644
--- a/quiche/quic/core/quic_dispatcher.h
+++ b/quiche/quic/core/quic_dispatcher.h
@@ -427,10 +427,6 @@
       ConnectionIdGeneratorInterface* connection_id_generator,
       absl::Span<const DispatcherSentPacket> dispatcher_sent_packets);
 
-  bool ack_buffered_initial_packets() const {
-    return buffered_packets_.ack_buffered_initial_packets();
-  }
-
   QuicDispatcherStats stats_;
 
   const QuicConfig* config_;
diff --git a/quiche/quic/core/tls_chlo_extractor.cc b/quiche/quic/core/tls_chlo_extractor.cc
index 996cd79..7466642 100644
--- a/quiche/quic/core/tls_chlo_extractor.cc
+++ b/quiche/quic/core/tls_chlo_extractor.cc
@@ -212,15 +212,13 @@
   }
   // QuicFramer is constructed without knowledge of the server's connection ID
   // so it needs to be set up here in order to decrypt the packet.
-  if (GetQuicRestartFlag(quic_dispatcher_ack_buffered_initial_packets)) {
-    // Only call SetInitialObfuscators once for the first ingested packet, whose
-    // |header.destination_connection_id| is the original connection ID.
-    if (framer_->GetDecrypter(ENCRYPTION_INITIAL) == nullptr) {
-      framer_->SetInitialObfuscators(header.destination_connection_id);
-    }
-  } else {
+  //
+  // Only call SetInitialObfuscators once for the first ingested packet, whose
+  // |header.destination_connection_id| is the original connection ID.
+  if (framer_->GetDecrypter(ENCRYPTION_INITIAL) == nullptr) {
     framer_->SetInitialObfuscators(header.destination_connection_id);
   }
+
   return true;
 }