@@ -112,7 +112,10 @@ void QuicCryptoContext::Keylog(const char* line) {
112
112
void QuicCryptoContext::OnClientHelloDone () {
113
113
// Continue the TLS handshake when this function exits
114
114
// 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
+
116
119
// Disable the callback at this point so we don't loop continuously
117
120
session_->state_ [IDX_QUIC_SESSION_STATE_CLIENT_HELLO_ENABLED] = 0 ;
118
121
}
@@ -129,8 +132,8 @@ void QuicCryptoContext::ResumeHandshake() {
129
132
// For 0RTT, this sets the TLS session data from the given buffer.
130
133
bool QuicCryptoContext::set_session (crypto::SSLSessionPointer session) {
131
134
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 ) ;
134
137
}
135
138
return crypto::SetTLSSession (ssl_, std::move (session));
136
139
}
@@ -186,7 +189,7 @@ std::string QuicCryptoContext::selected_alpn() const {
186
189
187
190
bool QuicCryptoContext::early_data () const {
188
191
return
189
- (early_data_ &&
192
+ (is_early_data () &&
190
193
SSL_get_early_data_status (ssl_.get ()) == SSL_EARLY_DATA_ACCEPTED) ||
191
194
SSL_get_max_early_data (ssl_.get ()) == 0xffffffffUL ;
192
195
}
@@ -300,13 +303,13 @@ void QuicSession::ExtendOffset(size_t amount) {
300
303
301
304
// Copies the local transport params into the given struct for serialization.
302
305
void QuicSession::GetLocalTransportParams (ngtcp2_transport_params* params) {
303
- CHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
306
+ CHECK (!is_destroyed ( ));
304
307
ngtcp2_conn_get_local_transport_params (connection (), params);
305
308
}
306
309
307
310
// Gets the QUIC version negotiated for this QuicSession
308
311
uint32_t QuicSession::negotiated_version () const {
309
- CHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
312
+ CHECK (!is_destroyed ( ));
310
313
return ngtcp2_conn_get_negotiated_version (connection ());
311
314
}
312
315
@@ -328,7 +331,7 @@ void QuicSession::HandshakeConfirmed() {
328
331
}
329
332
330
333
bool QuicSession::is_handshake_completed () const {
331
- DCHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
334
+ DCHECK (!is_destroyed ( ));
332
335
return ngtcp2_conn_get_handshake_completed (connection ());
333
336
}
334
337
@@ -342,7 +345,7 @@ void QuicSession::InitApplication() {
342
345
// immediately closed without attempting to send any additional data to
343
346
// the peer. All existing streams are abandoned and closed.
344
347
void QuicSession::OnIdleTimeout () {
345
- if (!is_flag_set (QUICSESSION_FLAG_DESTROYED )) {
348
+ if (!is_destroyed ( )) {
346
349
state_[IDX_QUIC_SESSION_STATE_IDLE_TIMEOUT] = 1 ;
347
350
Debug (this , " Idle timeout" );
348
351
SilentClose ();
@@ -359,7 +362,7 @@ void QuicSession::GetConnectionCloseInfo() {
359
362
360
363
// Removes the given connection id from the QuicSession.
361
364
void QuicSession::RemoveConnectionID (const QuicCID& cid) {
362
- if (!is_flag_set (QUICSESSION_FLAG_DESTROYED ))
365
+ if (!is_destroyed ( ))
363
366
DisassociateCID (cid);
364
367
}
365
368
@@ -440,24 +443,12 @@ SessionTicketAppData::Status QuicSession::GetSessionTicketAppData(
440
443
return application_->GetSessionTicketAppData (app_data, flag);
441
444
}
442
445
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
-
455
446
bool QuicSession::is_server () const {
456
447
return crypto_context_->side () == NGTCP2_CRYPTO_SIDE_SERVER;
457
448
}
458
449
459
450
void QuicSession::StartGracefulClose () {
460
- set_flag (QUICSESSION_FLAG_GRACEFUL_CLOSING );
451
+ set_graceful_closing ( );
461
452
RecordTimestamp (&QuicSessionStats::closing_at);
462
453
}
463
454
@@ -511,15 +502,15 @@ bool QuicSession::SendPacket(
511
502
}
512
503
513
504
void QuicSession::set_local_address (const ngtcp2_addr* addr) {
514
- DCHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
505
+ DCHECK (!is_destroyed ( ));
515
506
ngtcp2_conn_set_local_addr (connection (), addr);
516
507
}
517
508
518
509
// Set the transport parameters received from the remote peer
519
510
void QuicSession::set_remote_transport_params () {
520
- DCHECK (!is_flag_set (QUICSESSION_FLAG_DESTROYED ));
511
+ DCHECK (!is_destroyed ( ));
521
512
ngtcp2_conn_get_remote_transport_params (connection (), &transport_params_);
522
- set_flag (QUICSESSION_FLAG_HAS_TRANSPORT_PARAMS );
513
+ set_transport_params_set ( );
523
514
}
524
515
525
516
void QuicSession::StopIdleTimer () {
@@ -537,7 +528,7 @@ void QuicSession::StopRetransmitTimer() {
537
528
// parameter is an array of versions supported by the remote peer.
538
529
void QuicSession::VersionNegotiation (const uint32_t * sv, size_t nsv) {
539
530
CHECK (!is_server ());
540
- if (!is_flag_set (QUICSESSION_FLAG_DESTROYED ))
531
+ if (!is_destroyed ( ))
541
532
listener ()->OnVersionNegotiation (NGTCP2_PROTO_VER, sv, nsv);
542
533
}
543
534
0 commit comments