Change Application and Transport ConnectionClose codes to uint64_t
IETF QUIC Transport and Application ConnectionClose Error Codes were 16 bit
unsigned numbers. Draft 22 of the IETF QUIC specification changed them to be a
varint62, which we keep internally as a uint64_t. This CL effects that change.
The benefits of this CL are A) somewhat cleaner internal code (elimination of random casts) and B) applications can use the full 62 bits of the connection close codes when using IETF QUIC.
gfe-relnote: N/A IETF QUIC only, V99 flag protected.
PiperOrigin-RevId: 267594523
Change-Id: I0d6a8af0bb134c15d6b034de4237a02e0458ee47
diff --git a/quic/core/frames/quic_connection_close_frame.cc b/quic/core/frames/quic_connection_close_frame.cc
index a7b3d53..63e0aee 100644
--- a/quic/core/frames/quic_connection_close_frame.cc
+++ b/quic/core/frames/quic_connection_close_frame.cc
@@ -6,6 +6,7 @@
#include <memory>
+#include "net/third_party/quiche/src/quic/core/quic_constants.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
namespace quic {
@@ -34,7 +35,9 @@
application_error_code(ietf_application_error_code),
extracted_error_code(quic_error_code),
error_details(std::move(error_details)),
- transport_close_frame_type(0) {}
+ transport_close_frame_type(0) {
+ DCHECK_LE(ietf_application_error_code, kMaxIetfVarInt);
+}
QuicConnectionCloseFrame::QuicConnectionCloseFrame(
QuicErrorCode quic_error_code,
@@ -45,7 +48,9 @@
transport_error_code(transport_error_code),
extracted_error_code(quic_error_code),
error_details(std::move(error_details)),
- transport_close_frame_type(transport_frame_type) {}
+ transport_close_frame_type(transport_frame_type) {
+ DCHECK_LE(transport_error_code, kMaxIetfVarInt);
+}
std::ostream& operator<<(
std::ostream& os,
diff --git a/quic/core/frames/quic_connection_close_frame.h b/quic/core/frames/quic_connection_close_frame.h
index b4f4fd7..b0cef45 100644
--- a/quic/core/frames/quic_connection_close_frame.h
+++ b/quic/core/frames/quic_connection_close_frame.h
@@ -49,8 +49,7 @@
// - A 16 bit QuicErrorCode, which is used in Google QUIC.
union {
QuicIetfTransportErrorCodes transport_error_code;
- // TODO(fkastenholz): Change this to uint64_t to reflect -22 of the ID.
- uint16_t application_error_code;
+ uint64_t application_error_code;
QuicErrorCode quic_error_code;
};