@@ -112,7 +112,10 @@ void QuicCryptoContext::Keylog(const char* line) {
112112void QuicCryptoContext::OnClientHelloDone () {
113113 // Continue the TLS handshake when this function exits
114114 // otherwise it will stall and fail.
115- TLSHandshakeScope handshake (this , &in_client_hello_);
115+ TLSHandshakeScope handshake_scope (
116+ this ,
117+ [&]() { set_in_client_hello (false ); });
118+
116119 // Disable the callback at this point so we don't loop continuously
117120 session_->state_ [IDX_QUIC_SESSION_STATE_CLIENT_HELLO_ENABLED] = 0 ;
118121}
@@ -129,8 +132,8 @@ void QuicCryptoContext::ResumeHandshake() {
129132// For 0RTT, this sets the TLS session data from the given buffer.
130133bool QuicCryptoContext::set_session (crypto::SSLSessionPointer session) {
131134 if (side_ == NGTCP2_CRYPTO_SIDE_CLIENT && session != nullptr ) {
132- early_data_ =
133- SSL_SESSION_get_max_early_data (session.get ()) == 0xffffffffUL ;
135+ set_early_data (
136+ SSL_SESSION_get_max_early_data (session.get ()) == 0xffffffffUL ) ;
134137 }
135138 return crypto::SetTLSSession (ssl_, std::move (session));
136139}
@@ -186,7 +189,7 @@ std::string QuicCryptoContext::selected_alpn() const {
186189
187190bool QuicCryptoContext::early_data () const {
188191 return
189- (early_data_ &&
192+ (is_early_data () &&
190193 SSL_get_early_data_status (ssl_.get ()) == SSL_EARLY_DATA_ACCEPTED) ||
191194 SSL_get_max_early_data (ssl_.get ()) == 0xffffffffUL ;
192195}
@@ -300,13 +303,13 @@ void QuicSession::ExtendOffset(size_t amount) {
300303
301304// Copies the local transport params into the given struct for serialization.
302305void QuicSession::GetLocalTransportParams (ngtcp2_transport_params* params) {
303- CHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
306+ CHECK (!is_destroyed ( ));
304307 ngtcp2_conn_get_local_transport_params (connection (), params);
305308}
306309
307310// Gets the QUIC version negotiated for this QuicSession
308311uint32_t QuicSession::negotiated_version () const {
309- CHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
312+ CHECK (!is_destroyed ( ));
310313 return ngtcp2_conn_get_negotiated_version (connection ());
311314}
312315
@@ -328,7 +331,7 @@ void QuicSession::HandshakeConfirmed() {
328331}
329332
330333bool QuicSession::is_handshake_completed () const {
331- DCHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
334+ DCHECK (!is_destroyed ( ));
332335 return ngtcp2_conn_get_handshake_completed (connection ());
333336}
334337
@@ -342,7 +345,7 @@ void QuicSession::InitApplication() {
342345// immediately closed without attempting to send any additional data to
343346// the peer. All existing streams are abandoned and closed.
344347void QuicSession::OnIdleTimeout () {
345- if (!is_flag_set (QUICSESSION_FLAG_DESTROYED )) {
348+ if (!is_destroyed ( )) {
346349 state_[IDX_QUIC_SESSION_STATE_IDLE_TIMEOUT] = 1 ;
347350 Debug (this , " Idle timeout" );
348351 SilentClose ();
@@ -359,7 +362,7 @@ void QuicSession::GetConnectionCloseInfo() {
359362
360363// Removes the given connection id from the QuicSession.
361364void QuicSession::RemoveConnectionID (const QuicCID& cid) {
362- if (!is_flag_set (QUICSESSION_FLAG_DESTROYED ))
365+ if (!is_destroyed ( ))
363366 DisassociateCID (cid);
364367}
365368
@@ -440,24 +443,12 @@ SessionTicketAppData::Status QuicSession::GetSessionTicketAppData(
440443 return application_->GetSessionTicketAppData (app_data, flag);
441444}
442445
443- bool QuicSession::is_gracefully_closing () const {
444- return is_flag_set (QUICSESSION_FLAG_GRACEFUL_CLOSING);
445- }
446-
447- bool QuicSession::is_destroyed () const {
448- return is_flag_set (QUICSESSION_FLAG_DESTROYED);
449- }
450-
451- bool QuicSession::is_stateless_reset () const {
452- return is_flag_set (QUICSESSION_FLAG_STATELESS_RESET);
453- }
454-
455446bool QuicSession::is_server () const {
456447 return crypto_context_->side () == NGTCP2_CRYPTO_SIDE_SERVER;
457448}
458449
459450void QuicSession::StartGracefulClose () {
460- set_flag (QUICSESSION_FLAG_GRACEFUL_CLOSING );
451+ set_graceful_closing ( );
461452 RecordTimestamp (&QuicSessionStats::closing_at);
462453}
463454
@@ -511,15 +502,15 @@ bool QuicSession::SendPacket(
511502}
512503
513504void QuicSession::set_local_address (const ngtcp2_addr* addr) {
514- DCHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
505+ DCHECK (!is_destroyed ( ));
515506 ngtcp2_conn_set_local_addr (connection (), addr);
516507}
517508
518509// Set the transport parameters received from the remote peer
519510void QuicSession::set_remote_transport_params () {
520- DCHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
511+ DCHECK (!is_destroyed ( ));
521512 ngtcp2_conn_get_remote_transport_params (connection (), &transport_params_);
522- set_flag (QUICSESSION_FLAG_HAS_TRANSPORT_PARAMS );
513+ set_transport_params_set ( );
523514}
524515
525516void QuicSession::StopIdleTimer () {
@@ -537,7 +528,7 @@ void QuicSession::StopRetransmitTimer() {
537528// parameter is an array of versions supported by the remote peer.
538529void QuicSession::VersionNegotiation (const uint32_t * sv, size_t nsv) {
539530 CHECK (!is_server ());
540- if (!is_flag_set (QUICSESSION_FLAG_DESTROYED ))
531+ if (!is_destroyed ( ))
541532 listener ()->OnVersionNegotiation (NGTCP2_PROTO_VER, sv, nsv);
542533}
543534
0 commit comments