Add QUIC_BUG_IF to QuicUtils::GetCryptoStreamId
In QUIC versions that use CRYPTO frames (instead of stream 1 frames) for
the crypto handshake, the concept of a "crypto stream ID" makes no
sense, so QuicUtils::GetCryptoStreamId should hit a QUIC_BUG_IF to
prevent its misuse.
gfe-relnote: Add QUIC_BUG_IF protected behind QuicVersionUsesCryptoFrames
PiperOrigin-RevId: 248463613
Change-Id: If6768658e9ffc058778b53a91f95839826602fbf
diff --git a/quic/core/quic_utils.h b/quic/core/quic_utils.h
index befeee7..bac025e 100644
--- a/quic/core/quic_utils.h
+++ b/quic/core/quic_utils.h
@@ -116,6 +116,11 @@
// Returns crypto stream ID of |version|.
static QuicStreamId GetCryptoStreamId(QuicTransportVersion version);
+ // Returns whether |id| is the stream ID for the crypto stream. If |version|
+ // is a version where crypto data doesn't go over stream frames, this function
+ // will always return false.
+ static bool IsCryptoStreamId(QuicTransportVersion version, QuicStreamId id);
+
// Returns headers stream ID of |version|.
static QuicStreamId GetHeadersStreamId(QuicTransportVersion version);