Deprecate --gfe2_reloadable_flag_quic_close_connection_if_fail_to_serialzie_coalesced_packet2.

PiperOrigin-RevId: 447535292
diff --git a/quiche/quic/core/quic_connection.cc b/quiche/quic/core/quic_connection.cc
index 1d134b5..73f5763 100644
--- a/quiche/quic/core/quic_connection.cc
+++ b/quiche/quic/core/quic_connection.cc
@@ -6025,11 +6025,7 @@
   const size_t length = packet_creator_.SerializeCoalescedPacket(
       coalesced_packet_, buffer, coalesced_packet_.max_packet_length());
   if (length == 0) {
-    if (packet_creator_
-            .close_connection_if_fail_to_serialzie_coalesced_packet() &&
-        connected_) {
-      QUIC_RELOADABLE_FLAG_COUNT_N(
-          quic_close_connection_if_fail_to_serialzie_coalesced_packet2, 2, 2);
+    if (connected_) {
       CloseConnection(QUIC_FAILED_TO_SERIALIZE_PACKET,
                       "Failed to serialize coalesced packet.",
                       ConnectionCloseBehavior::SILENT_CLOSE);
diff --git a/quiche/quic/core/quic_connection_test.cc b/quiche/quic/core/quic_connection_test.cc
index 4a0db07..0da0673 100644
--- a/quiche/quic/core/quic_connection_test.cc
+++ b/quiche/quic/core/quic_connection_test.cc
@@ -9919,12 +9919,8 @@
 
   EXPECT_CALL(visitor_, OnHandshakePacketSent());
 
-  if (GetQuicReloadableFlag(
-          quic_close_connection_if_fail_to_serialzie_coalesced_packet2)) {
-    EXPECT_CALL(visitor_,
-                OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
-        .WillOnce(Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
-  }
+  EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
+      .WillOnce(Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
 
   ProcessDataPacketAtLevel(1, !kHasStopWaiting, ENCRYPTION_INITIAL);
   auto test_body = [&] {
@@ -9970,16 +9966,11 @@
 
   EXPECT_QUIC_BUG(test_body(), "SerializeCoalescedPacket failed.");
 
-  if (GetQuicReloadableFlag(
-          quic_close_connection_if_fail_to_serialzie_coalesced_packet2)) {
-    EXPECT_FALSE(connection_.connected());
-    EXPECT_THAT(saved_connection_close_frame_.quic_error_code,
-                IsError(QUIC_FAILED_TO_SERIALIZE_PACKET));
-    EXPECT_EQ(saved_connection_close_frame_.error_details,
-              "Failed to serialize coalesced packet.");
-  } else {
-    EXPECT_TRUE(connection_.connected());
-  }
+  EXPECT_FALSE(connection_.connected());
+  EXPECT_THAT(saved_connection_close_frame_.quic_error_code,
+              IsError(QUIC_FAILED_TO_SERIALIZE_PACKET));
+  EXPECT_EQ(saved_connection_close_frame_.error_details,
+            "Failed to serialize coalesced packet.");
 }
 
 TEST_P(QuicConnectionTest, LegacyVersionEncapsulation) {
@@ -15272,22 +15263,12 @@
   // Server receives INITIAL 3, this will serialzie FS 7 (stream 4, stream 8),
   // which will trigger a flush of a coalesced packet consists of INITIAL 4,
   // HS 5 and FS 6 (stream 4).
-  if (GetQuicReloadableFlag(
-          quic_close_connection_if_fail_to_serialzie_coalesced_packet2)) {
-    // Expect no QUIC_BUG.
-    ProcessDataPacketAtLevel(3, !kHasStopWaiting, ENCRYPTION_INITIAL);
-    EXPECT_EQ(
-        debug_visitor_sent_count,
-        connection_.sent_packet_manager().GetLargestSentPacket().ToUint64());
-  } else {
-    // Expect QUIC_BUG due to extra padding.
-    EXPECT_QUIC_BUG(
-        { ProcessDataPacketAtLevel(3, !kHasStopWaiting, ENCRYPTION_INITIAL); },
-        "Reserialize initial packet in coalescer has unexpected size");
-    EXPECT_EQ(
-        debug_visitor_sent_count + 1,
-        connection_.sent_packet_manager().GetLargestSentPacket().ToUint64());
-  }
+
+  // Expect no QUIC_BUG.
+  ProcessDataPacketAtLevel(3, !kHasStopWaiting, ENCRYPTION_INITIAL);
+  EXPECT_EQ(
+      debug_visitor_sent_count,
+      connection_.sent_packet_manager().GetLargestSentPacket().ToUint64());
 
   // The error only happens if after serializing the second 1RTT packet(pkt #7),
   // the pending padding bytes is non zero.
diff --git a/quiche/quic/core/quic_flags_list.h b/quiche/quic/core/quic_flags_list.h
index be6303b..75c3687 100644
--- a/quiche/quic/core/quic_flags_list.h
+++ b/quiche/quic/core/quic_flags_list.h
@@ -19,8 +19,6 @@
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_bbr2_no_probe_up_exit_if_no_queue, true)
 // If true, 1) QUIC connections will use a lower minimum for trusted initial rtt, 2) When TRTT is received, QUIC server sessions will mark the initial rtt from CachedNetworkParameters as trusted.
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_use_lower_min_for_trusted_irtt, true)
-// If true, QUIC connection will be closed if it fails to serialize a coalesced packet.
-QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_close_connection_if_fail_to_serialzie_coalesced_packet2, true)
 // If true, QUIC will default enable MTU discovery at server, with a target of 1450 bytes.
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_enable_mtu_discovery_at_server, 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/quic_packet_creator.cc b/quiche/quic/core/quic_packet_creator.cc
index c84556c..94921c4 100644
--- a/quiche/quic/core/quic_packet_creator.cc
+++ b/quiche/quic/core/quic_packet_creator.cc
@@ -511,8 +511,7 @@
       << "Attempt to serialize empty ENCRYPTION_INITIAL packet in coalesced "
          "packet";
 
-  if (close_connection_if_fail_to_serialzie_coalesced_packet_ &&
-      HasPendingFrames()) {
+  if (HasPendingFrames()) {
     QUIC_BUG(quic_packet_creator_unexpected_queued_frames)
         << "Unexpected queued frames: " << GetPendingFramesInfo();
     return 0;
@@ -549,15 +548,8 @@
     }
   }
 
-  if (close_connection_if_fail_to_serialzie_coalesced_packet_) {
-    QUIC_RELOADABLE_FLAG_COUNT_N(
-        quic_close_connection_if_fail_to_serialzie_coalesced_packet2, 1, 2);
-  }
-
-  if (!SerializePacket(
-          QuicOwnedPacketBuffer(buffer, nullptr), buffer_len,
-          /*allow_padding=*/
-          !close_connection_if_fail_to_serialzie_coalesced_packet_)) {
+  if (!SerializePacket(QuicOwnedPacketBuffer(buffer, nullptr), buffer_len,
+                       /*allow_padding=*/false)) {
     return 0;
   }
   const size_t encrypted_length = packet_.encrypted_length;
diff --git a/quiche/quic/core/quic_packet_creator.h b/quiche/quic/core/quic_packet_creator.h
index bc792e1..51446ba 100644
--- a/quiche/quic/core/quic_packet_creator.h
+++ b/quiche/quic/core/quic_packet_creator.h
@@ -485,10 +485,6 @@
 
   const QuicSocketAddress& peer_address() const { return packet_.peer_address; }
 
-  bool close_connection_if_fail_to_serialzie_coalesced_packet() const {
-    return close_connection_if_fail_to_serialzie_coalesced_packet_;
-  }
-
  private:
   friend class test::QuicPacketCreatorPeer;
 
@@ -692,10 +688,6 @@
 
   // Whether to attempt protecting initial packets with chaos.
   bool chaos_protection_enabled_;
-
-  const bool close_connection_if_fail_to_serialzie_coalesced_packet_ =
-      GetQuicReloadableFlag(
-          quic_close_connection_if_fail_to_serialzie_coalesced_packet2);
 };
 
 }  // namespace quic