In quic, do not arm pto if the only in flight packet is half rtt data before handshake completion. protected by gfe2_reloadable_flag_quic_fix_server_pto_timeout.

PiperOrigin-RevId: 314387174
Change-Id: Ic9d101357e1584def827be55d14c2ea1c79c3555
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 6970af7..8ab8211 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -1041,6 +1041,16 @@
     // Do not set the timer if there is any credit left.
     return QuicTime::Zero();
   }
+  PacketNumberSpace packet_number_space;
+  if (GetQuicReloadableFlag(quic_fix_server_pto_timeout) &&
+      supports_multiple_packet_number_spaces() &&
+      unacked_packets_.perspective() == Perspective::IS_SERVER &&
+      !GetEarliestPacketSentTimeForPto(&packet_number_space).IsInitialized()) {
+    // Do not set the timer on the server side if the only in flight packets are
+    // half RTT data.
+    QUIC_RELOADABLE_FLAG_COUNT(quic_fix_server_pto_timeout);
+    return QuicTime::Zero();
+  }
   switch (GetRetransmissionMode()) {
     case HANDSHAKE_MODE:
       return unacked_packets_.GetLastCryptoPacketSentTime() +