In quic, bundle server initial crypto data with initial ack. protected by gfe2_reloadable_flag_quic_bundle_crypto_data_with_initial_ack.

This is used to speed up handshake since INITIAL ACK will be padded to full anyway.

PiperOrigin-RevId: 317176505
Change-Id: I5444372466c64cdc662792333916d74b08e8b594
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 31ac454..d74a487 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -912,6 +912,27 @@
   pto_exponential_backoff_start_point_ = exponential_backoff_start_point;
 }
 
+void QuicSentPacketManager::RetransmitInitialDataIfAny() {
+  DCHECK(supports_multiple_packet_number_spaces());
+  if (!unacked_packets_.GetLastInFlightPacketSentTime(INITIAL_DATA)
+           .IsInitialized()) {
+    // No in flight initial data.
+    return;
+  }
+  QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
+  for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin();
+       it != unacked_packets_.end(); ++it, ++packet_number) {
+    if (it->state == OUTSTANDING &&
+        unacked_packets_.HasRetransmittableFrames(*it) &&
+        unacked_packets_.GetPacketNumberSpace(it->encryption_level) ==
+            INITIAL_DATA) {
+      DCHECK(it->in_flight);
+      MarkForRetransmission(packet_number, PTO_RETRANSMISSION);
+      return;
+    }
+  }
+}
+
 QuicSentPacketManager::RetransmissionTimeoutMode
 QuicSentPacketManager::GetRetransmissionMode() const {
   DCHECK(unacked_packets_.HasInFlightPackets() ||