Change IETF Frame/QUIC_VERSION_99 tests to be symbolic.
This CL replaces checks for QUIC_VERSION_99 that are controlling the IETF frames and their associated functionality with a function call . The function has a name that is indicative of the features for which the version is being checked -- VersionHasIetfQuicFrames().
gfe-relnote: N/A just changes the text by which we test if IETF QUIC has been negotiated.
PiperOrigin-RevId: 253767805
Change-Id: I08ae6738411ac151f90d5d085ea69af90d79fb80
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc
index 955e82f..88ffa38 100644
--- a/quic/core/quic_utils.cc
+++ b/quic/core/quic_utils.cc
@@ -377,8 +377,9 @@
// static
QuicStreamId QuicUtils::GetInvalidStreamId(QuicTransportVersion version) {
- return version == QUIC_VERSION_99 ? std::numeric_limits<QuicStreamId>::max()
- : 0;
+ return VersionHasIetfQuicFrames(version)
+ ? std::numeric_limits<QuicStreamId>::max()
+ : 0;
}
// static
@@ -413,7 +414,7 @@
if (id == GetInvalidStreamId(version)) {
return false;
}
- return version == QUIC_VERSION_99 ? id % 2 == 0 : id % 2 != 0;
+ return VersionHasIetfQuicFrames(version) ? id % 2 == 0 : id % 2 != 0;
}
// static
@@ -422,7 +423,7 @@
if (id == GetInvalidStreamId(version)) {
return false;
}
- return version == QUIC_VERSION_99 ? id % 2 != 0 : id % 2 == 0;
+ return VersionHasIetfQuicFrames(version) ? id % 2 != 0 : id % 2 == 0;
}
// static
@@ -459,14 +460,14 @@
// static
QuicStreamId QuicUtils::StreamIdDelta(QuicTransportVersion version) {
- return version == QUIC_VERSION_99 ? 4 : 2;
+ return VersionHasIetfQuicFrames(version) ? 4 : 2;
}
// static
QuicStreamId QuicUtils::GetFirstBidirectionalStreamId(
QuicTransportVersion version,
Perspective perspective) {
- if (version == QUIC_VERSION_99) {
+ if (VersionHasIetfQuicFrames(version)) {
return perspective == Perspective::IS_CLIENT ? 0 : 1;
} else if (QuicVersionUsesCryptoFrames(version)) {
return perspective == Perspective::IS_CLIENT ? 1 : 2;
@@ -478,7 +479,7 @@
QuicStreamId QuicUtils::GetFirstUnidirectionalStreamId(
QuicTransportVersion version,
Perspective perspective) {
- if (version == QUIC_VERSION_99) {
+ if (VersionHasIetfQuicFrames(version)) {
return perspective == Perspective::IS_CLIENT ? 2 : 3;
} else if (QuicVersionUsesCryptoFrames(version)) {
return perspective == Perspective::IS_CLIENT ? 1 : 2;