Do not queue coalesced undecryptable packets twice
This CL adds QuicFramerVisitorInterface::OnUndecryptablePacket and uses it to send undecryptable packets from QuicFramer to QuicConnection, instead of the previous mechanism which relied on QuicFramer::ProcessPacket returning QUIC_DECRYPTION_FAILURE. The new mechanism has the following advantages:
1) It only sends the current packet, without any subsequent coalesced packets
2) It knows if the decryption failed due to a missing key, which allows us to avoid buffering packets that we know we will never be able to decrypt
This mechanism is enabled for versions that KnowsWhichDecrypterToUse() (which are v47+ || TLS, none of which are currently enabled) and when the new flag quic_framer_uses_undecryptable_upcall is true - the intent being to enable this for all versions once the flag protection process is complete.
This CL also adds QuicDataReader::FullPayload which is required to extract only this packet without further coalesced packets, and associated test.
gfe-relnote: do not queue coalesced undecryptable packets twice, protected by disabled flag gfe2_restart_flag_quic_framer_uses_undecryptable_upcall
PiperOrigin-RevId: 263658152
Change-Id: I66aca2138e353306a5cf4fa9ec259680f4115890
diff --git a/quic/core/quic_packets.h b/quic/core/quic_packets.h
index 3af15ea..5c34b64 100644
--- a/quic/core/quic_packets.h
+++ b/quic/core/quic_packets.h
@@ -204,8 +204,13 @@
class QUIC_EXPORT_PRIVATE QuicData {
public:
+ // Creates a QuicData from a buffer and length. Does not own the buffer.
QuicData(const char* buffer, size_t length);
+ // Creates a QuicData from a buffer and length,
+ // optionally taking ownership of the buffer.
QuicData(const char* buffer, size_t length, bool owns_buffer);
+ // Creates a QuicData from a QuicStringPiece. Does not own the buffer.
+ QuicData(QuicStringPiece data);
QuicData(const QuicData&) = delete;
QuicData& operator=(const QuicData&) = delete;
virtual ~QuicData();
@@ -263,8 +268,16 @@
class QUIC_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData {
public:
+ // Creates a QuicEncryptedPacket from a buffer and length.
+ // Does not own the buffer.
QuicEncryptedPacket(const char* buffer, size_t length);
+ // Creates a QuicEncryptedPacket from a buffer and length,
+ // optionally taking ownership of the buffer.
QuicEncryptedPacket(const char* buffer, size_t length, bool owns_buffer);
+ // Creates a QuicEncryptedPacket from a QuicStringPiece.
+ // Does not own the buffer.
+ QuicEncryptedPacket(QuicStringPiece data);
+
QuicEncryptedPacket(const QuicEncryptedPacket&) = delete;
QuicEncryptedPacket& operator=(const QuicEncryptedPacket&) = delete;