Change constructors for QuiConnectionCloseFrame Change the constructors for the QuicConnectionCloseFrame to properly handle generation of IETF Transport/Application Connection Closes vs Google QUIC Connection Closes gfe-relnote: N/A constructor change only, changes used only for IETF QUIC (V99) PiperOrigin-RevId: 255037353 Change-Id: Ia64291202b27b1682b8ccb88c331623b81d22fe5
diff --git a/quic/core/frames/quic_connection_close_frame.cc b/quic/core/frames/quic_connection_close_frame.cc index ad51068..d436499 100644 --- a/quic/core/frames/quic_connection_close_frame.cc +++ b/quic/core/frames/quic_connection_close_frame.cc
@@ -25,16 +25,25 @@ transport_close_frame_type(0) {} QuicConnectionCloseFrame::QuicConnectionCloseFrame( - QuicIetfTransportErrorCodes transport_error_code, - QuicErrorCode extracted_error_code, + QuicErrorCode quic_error_code, std::string error_details, - uint64_t transport_close_frame_type) - // Default close type ensures that existing, pre-V99 code works as expected. - : close_type(GOOGLE_QUIC_CONNECTION_CLOSE), - transport_error_code(transport_error_code), - extracted_error_code(extracted_error_code), + uint64_t ietf_application_error_code) + : close_type(IETF_QUIC_APPLICATION_CONNECTION_CLOSE), + application_error_code(ietf_application_error_code), + extracted_error_code(quic_error_code), error_details(std::move(error_details)), - transport_close_frame_type(transport_close_frame_type) {} + transport_close_frame_type(0) {} + +QuicConnectionCloseFrame::QuicConnectionCloseFrame( + QuicErrorCode quic_error_code, + std::string error_details, + QuicIetfTransportErrorCodes transport_error_code, + uint64_t transport_frame_type) + : close_type(IETF_QUIC_TRANSPORT_CONNECTION_CLOSE), + 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) {} 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 68ed112..8025fbe 100644 --- a/quic/core/frames/quic_connection_close_frame.h +++ b/quic/core/frames/quic_connection_close_frame.h
@@ -26,11 +26,21 @@ struct QUIC_EXPORT_PRIVATE QuicConnectionCloseFrame { QuicConnectionCloseFrame(); + + // TODO(fkastenholz): After migration to supporting IETF QUIC, this probably + // should be deprecated. QuicConnectionCloseFrame(QuicErrorCode error_code, std::string error_details); - QuicConnectionCloseFrame(QuicIetfTransportErrorCodes transport_error_code, - QuicErrorCode extracted_error_code, + + // Sets close_type to IETF_QUIC_APPLICATION_CONNECTION_CLOSE. + QuicConnectionCloseFrame(QuicErrorCode quic_error_code, std::string error_details, - uint64_t frame_type); + uint64_t ietf_application_error_code); + + // Sets close_type to IETF_QUIC_TRANSPORT_CONNECTION_CLOSE. + QuicConnectionCloseFrame(QuicErrorCode quic_error_code, + std::string error_details, + QuicIetfTransportErrorCodes transport_error_code, + uint64_t transport_frame_type); friend QUIC_EXPORT_PRIVATE std::ostream& operator<<( std::ostream& os,