gfe-relnote: Change QuicRstStream::ietf_error_code to 64 bits and move it out of the union with error_code. Behavior change in IETF QUIC only, protected by gfe2_reloadable_flag_quic_enable_version_draft_25_v3 and gfe2_reloadable_flag_quic_enable_version_draft_27.
Multiple tests rely on ietf_error_code being set to the value of error_code.
However, if they stay in a union, and ietf_error_code is changed to 64 bits,
then the upper bits will be unitialized, because error_code has fewer bits.
Fortunately I was planning to move them out of the union so that upper layers
can still interact with QuicRstStreamErrorCode regardless of QUIC version.
PiperOrigin-RevId: 305870819
Change-Id: Iae47ede459094ade6f9dc7fddfc9acadb82fa417
diff --git a/quic/core/frames/quic_rst_stream_frame.cc b/quic/core/frames/quic_rst_stream_frame.cc
index 63cf6ea..d9e14b7 100644
--- a/quic/core/frames/quic_rst_stream_frame.cc
+++ b/quic/core/frames/quic_rst_stream_frame.cc
@@ -20,15 +20,8 @@
: control_frame_id(control_frame_id),
stream_id(stream_id),
error_code(error_code),
- byte_offset(bytes_written) {}
-
-QuicRstStreamFrame::QuicRstStreamFrame(QuicControlFrameId control_frame_id,
- QuicStreamId stream_id,
- uint16_t ietf_error_code,
- QuicStreamOffset bytes_written)
- : control_frame_id(control_frame_id),
- stream_id(stream_id),
- ietf_error_code(ietf_error_code),
+ // TODO(b/124216424): Translate QuicRstStreamErrorCode to IETF error code.
+ ietf_error_code(error_code),
byte_offset(bytes_written) {}
std::ostream& operator<<(std::ostream& os,
diff --git a/quic/core/frames/quic_rst_stream_frame.h b/quic/core/frames/quic_rst_stream_frame.h
index 9a9ed56..6239123 100644
--- a/quic/core/frames/quic_rst_stream_frame.h
+++ b/quic/core/frames/quic_rst_stream_frame.h
@@ -18,10 +18,6 @@
QuicStreamId stream_id,
QuicRstStreamErrorCode error_code,
QuicStreamOffset bytes_written);
- QuicRstStreamFrame(QuicControlFrameId control_frame_id,
- QuicStreamId stream_id,
- uint16_t ietf_error_code,
- QuicStreamOffset bytes_written);
friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(
std::ostream& os,
@@ -33,15 +29,12 @@
QuicStreamId stream_id;
- // Caller must know whether IETF- or Google- QUIC is in use and
- // set the appropriate error code.
- union {
- QuicRstStreamErrorCode error_code;
- // In IETF QUIC the code is up to the app on top of quic, so is
- // more general than QuicRstStreamErrorCode allows.
- // TODO(fkastenholz): Upgrade to uint64_t
- uint16_t ietf_error_code;
- };
+ // Used for Google QUIC only.
+ // TODO(b/124216424): Consider using meaningful values when using IETF QUIC.
+ QuicRstStreamErrorCode error_code;
+
+ // Used for IETF QUIC only.
+ uint64_t ietf_error_code;
// Used to update flow control windows. On termination of a stream, both
// endpoints must inform the peer of the number of bytes they have sent on
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index dd880d7..da5d4c5 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -5765,18 +5765,14 @@
return false;
}
- uint64_t error_code;
- if (!reader->ReadVarInt62(&error_code)) {
+ if (!reader->ReadVarInt62(&frame->ietf_error_code)) {
set_detailed_error("Unable to read rst stream error code.");
return false;
}
- if (error_code > 0xffff) {
- frame->ietf_error_code = 0xffff;
- QUIC_DLOG(ERROR) << "Reset stream error code (" << error_code
- << ") > 0xffff";
- } else {
- frame->ietf_error_code = static_cast<uint16_t>(error_code);
- }
+
+ // TODO(b/124216424): Translate IETF error code to QuicRstStreamErrorCode.
+ frame->error_code =
+ static_cast<QuicRstStreamErrorCode>(frame->ietf_error_code);
if (!reader->ReadVarInt62(&frame->byte_offset)) {
set_detailed_error("Unable to read rst stream sent byte offset.");