gfe-relnote: In QUIC, add SetSoftMaxPacketLength to set a soft max packet length in creator. If a single frame is failed to be serialized, restore the actual max packet length. Not used yet. Not protected.
PiperOrigin-RevId: 278424350
Change-Id: Ie89ba741b6798dee0683b4678edc9242f37f7672
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index 73e69c1..b8240c1 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -270,6 +270,11 @@
// Sets the maximum packet length.
void SetMaxPacketLength(QuicByteCount length);
+ // Set a soft maximum packet length in the creator. If a packet cannot be
+ // successfully created, creator will remove the soft limit and use the actual
+ // max packet length.
+ void SetSoftMaxPacketLength(QuicByteCount length);
+
// Increases pending_padding_bytes by |size|. Pending padding will be sent by
// MaybeAddPadding().
void AddPendingPadding(QuicByteCount size);
@@ -476,6 +481,13 @@
// Returns true on success.
bool MaybeCoalesceStreamFrame(const QuicStreamFrame& frame);
+ // Called to remove the soft max_packet_length and restores
+ // latched_hard_max_packet_length_ if the packet cannot accommodate a single
+ // frame. Returns true if the soft limit is successfully removed. Returns
+ // false if either there is no current soft limit or there are queued frames
+ // (such that the packet length cannot be changed).
+ bool RemoveSoftMaxPacketLength();
+
// Returns true if a diversification nonce should be included in the current
// packet's header.
bool IncludeNonceInPublicHeader() const;
@@ -575,6 +587,11 @@
// flusher detaches.
QuicPacketNumber write_start_packet_number_;
+ // If not 0, this latches the actual max_packet_length when
+ // SetSoftMaxPacketLength is called and max_packet_length_ gets
+ // set to a soft value.
+ QuicByteCount latched_hard_max_packet_length_;
+
// Latched value of quic_combine_generator_and_creator.
const bool combine_generator_and_creator_;