Deprecate gfe2_reloadable_flag_quic_check_keys_before_writing.

PiperOrigin-RevId: 343912495
Change-Id: Ifb29e259d22e1a1a81bd14fc6b3911afdb19fab7
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index bca806e..19d6ac3 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -4906,14 +4906,11 @@
     return;
   }
 
-  if (check_keys_before_writing_) {
-    QUIC_RELOADABLE_FLAG_COUNT_N(quic_check_keys_before_writing, 1, 2);
-    if (!framer_.HasAnEncrypterForSpace(space)) {
-      QUIC_BUG << ENDPOINT
-               << "Try to bundle crypto with ACK with missing key of space "
-               << PacketNumberSpaceToString(space);
-      return;
-    }
+  if (!framer_.HasAnEncrypterForSpace(space)) {
+    QUIC_BUG << ENDPOINT
+             << "Try to bundle crypto with ACK with missing key of space "
+             << PacketNumberSpaceToString(space);
+    return;
   }
 
   sent_packet_manager_.RetransmitDataOfSpaceIfAny(space);
@@ -4939,12 +4936,9 @@
     if (!ack_timeout.IsInitialized()) {
       continue;
     }
-    if (check_keys_before_writing_) {
-      QUIC_RELOADABLE_FLAG_COUNT_N(quic_check_keys_before_writing, 2, 2);
-      if (!framer_.HasAnEncrypterForSpace(static_cast<PacketNumberSpace>(i))) {
-        // The key has been dropped.
-        continue;
-      }
+    if (!framer_.HasAnEncrypterForSpace(static_cast<PacketNumberSpace>(i))) {
+      // The key has been dropped.
+      continue;
     }
     if (ack_timeout > clock_->ApproximateNow() &&
         ack_timeout > earliest_ack_timeout) {
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 599331d..823fa93 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -1140,8 +1140,6 @@
     can_receive_ack_frequency_frame_ = true;
   }
 
-  bool check_keys_before_writing() const { return check_keys_before_writing_; }
-
   bool is_processing_packet() const { return framer_.is_processing_packet(); }
 
   bool encrypted_control_frames() const { return encrypted_control_frames_; }
@@ -1959,9 +1957,6 @@
   const bool fix_out_of_order_sending_ =
       GetQuicReloadableFlag(quic_fix_out_of_order_sending2);
 
-  const bool check_keys_before_writing_ =
-      GetQuicReloadableFlag(quic_check_keys_before_writing);
-
   const bool encrypted_control_frames_;
 
   const bool use_encryption_level_context_;
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h
index b021175..c5d0a9f 100644
--- a/quic/core/quic_flags_list.h
+++ b/quic/core/quic_flags_list.h
@@ -16,7 +16,6 @@
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_bbr2_startup_loss_exit_use_max_delivered, true)
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_bbr2_support_max_bootstrap_cwnd, true)
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_can_send_ack_frequency, true)
-QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_check_keys_before_writing, true)
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_close_connection_in_on_can_write_with_blocked_writer, true)
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_connection_set_initial_self_address, true)
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_conservative_bursts, false)
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 44fe0c8..2e1895e 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -795,8 +795,7 @@
                                    QuicStreamOffset offset,
                                    TransmissionType type) {
   DCHECK(QuicVersionUsesCryptoFrames(transport_version()));
-  if (connection()->check_keys_before_writing() &&
-      !connection()->framer().HasEncrypterOfEncryptionLevel(level)) {
+  if (!connection()->framer().HasEncrypterOfEncryptionLevel(level)) {
     const std::string error_details = quiche::QuicheStrCat(
         "Try to send crypto data with missing keys of encryption level: ",
         EncryptionLevelToString(level));