@@ -293,9 +293,9 @@ void QuicSessionListener::OnSessionDestroyed() {
293
293
previous_listener_->OnSessionDestroyed ();
294
294
}
295
295
296
- void QuicSessionListener::OnSessionClose (QuicError error) {
296
+ void QuicSessionListener::OnSessionClose (QuicError error, int flags ) {
297
297
if (previous_listener_ != nullptr )
298
- previous_listener_->OnSessionClose (error);
298
+ previous_listener_->OnSessionClose (error, flags );
299
299
}
300
300
301
301
void QuicSessionListener::OnStreamReady (BaseObjectPtr<QuicStream> stream) {
@@ -328,13 +328,6 @@ void QuicSessionListener::OnStreamBlocked(int64_t stream_id) {
328
328
}
329
329
}
330
330
331
- void QuicSessionListener::OnSessionSilentClose (
332
- bool stateless_reset,
333
- QuicError error) {
334
- if (previous_listener_ != nullptr )
335
- previous_listener_->OnSessionSilentClose (stateless_reset, error);
336
- }
337
-
338
331
void QuicSessionListener::OnUsePreferredAddress (
339
332
int family,
340
333
const PreferredAddress& preferred_address) {
@@ -525,14 +518,20 @@ void JSQuicSessionListener::OnSessionDestroyed() {
525
518
env->quic_on_session_destroyed_function (), 0 , nullptr );
526
519
}
527
520
528
- void JSQuicSessionListener::OnSessionClose (QuicError error) {
521
+ void JSQuicSessionListener::OnSessionClose (QuicError error, int flags ) {
529
522
Environment* env = session ()->env ();
530
523
HandleScope scope (env->isolate ());
531
524
Context::Scope context_scope (env->context ());
532
525
533
526
Local<Value> argv[] = {
534
527
Number::New (env->isolate (), static_cast <double >(error.code )),
535
- Integer::New (env->isolate (), error.family )
528
+ Integer::New (env->isolate (), error.family ),
529
+ flags & SESSION_CLOSE_FLAG_SILENT
530
+ ? v8::True (env->isolate ())
531
+ : v8::False (env->isolate ()),
532
+ flags & SESSION_CLOSE_FLAG_STATELESS_RESET
533
+ ? v8::True (env->isolate ())
534
+ : v8::False (env->isolate ())
536
535
};
537
536
538
537
// Grab a shared pointer to this to prevent the QuicSession
@@ -664,26 +663,6 @@ void JSQuicSessionListener::OnSessionTicket(int size, SSL_SESSION* sess) {
664
663
arraysize (argv), argv);
665
664
}
666
665
667
- void JSQuicSessionListener::OnSessionSilentClose (
668
- bool stateless_reset,
669
- QuicError error) {
670
- Environment* env = session ()->env ();
671
- HandleScope scope (env->isolate ());
672
- Context::Scope context_scope (env->context ());
673
-
674
- Local<Value> argv[] = {
675
- stateless_reset ? v8::True (env->isolate ()) : v8::False (env->isolate ()),
676
- Number::New (env->isolate (), static_cast <double >(error.code )),
677
- Integer::New (env->isolate (), error.family )
678
- };
679
-
680
- // Grab a shared pointer to this to prevent the QuicSession
681
- // from being freed while the MakeCallback is running.
682
- BaseObjectPtr<QuicSession> ptr (session ());
683
- session ()->MakeCallback (
684
- env->quic_on_session_silent_close_function (), arraysize (argv), argv);
685
- }
686
-
687
666
void JSQuicSessionListener::OnUsePreferredAddress (
688
667
int family,
689
668
const PreferredAddress& preferred_address) {
@@ -2377,7 +2356,10 @@ void QuicSession::SilentClose() {
2377
2356
err.code ,
2378
2357
is_stateless_reset () ? " yes" : " no" );
2379
2358
2380
- listener ()->OnSessionSilentClose (is_stateless_reset (), err);
2359
+ int flags = QuicSessionListener::SESSION_CLOSE_FLAG_SILENT;
2360
+ if (is_stateless_reset ())
2361
+ flags |= QuicSessionListener::SESSION_CLOSE_FLAG_STATELESS_RESET;
2362
+ listener ()->OnSessionClose (err, flags);
2381
2363
}
2382
2364
// Begin connection close by serializing the CONNECTION_CLOSE packet.
2383
2365
// There are two variants: one to serialize an application close, the
0 commit comments