gfe-relnote: In QUIC, skipping a packet number, when a single PTO packet will be sent, to elicit an immediate ACK. Protected by gfe2_reloadable_flag_quic_skip_packet_number_for_pto.
PiperOrigin-RevId: 268899762
Change-Id: I5c4313b8c9b2a01392f4728bd6364071657fa0d5
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index 0b7a9f2..4c381d4 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -159,6 +159,33 @@
framer_->transport_version(), QuicPacketNumber(delta * 4));
}
+void QuicPacketCreator::SkipNPacketNumbers(
+ QuicPacketCount count,
+ QuicPacketNumber least_packet_awaited_by_peer,
+ QuicPacketCount max_packets_in_flight) {
+ if (!queued_frames_.empty()) {
+ // Don't change creator state if there are frames queued.
+ QUIC_BUG << "Called SkipNPacketNumbers with " << queued_frames_.size()
+ << " queued_frames. First frame type:"
+ << queued_frames_.front().type
+ << " last frame type:" << queued_frames_.back().type;
+ return;
+ }
+ if (packet_.packet_number > packet_.packet_number + count) {
+ // Skipping count packet numbers causes packet number wrapping around,
+ // reject it.
+ QUIC_LOG(WARNING) << "Skipping " << count
+ << " packet numbers causes packet number wrapping "
+ "around, least_packet_awaited_by_peer: "
+ << least_packet_awaited_by_peer
+ << " packet_number:" << packet_.packet_number;
+ return;
+ }
+ packet_.packet_number += count;
+ // Packet number changes, update packet number length if necessary.
+ UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight);
+}
+
bool QuicPacketCreator::ConsumeCryptoData(EncryptionLevel level,
size_t write_length,
QuicStreamOffset offset,