@@ -293,9 +293,9 @@ void QuicSessionListener::OnSessionDestroyed() {
293293 previous_listener_->OnSessionDestroyed ();
294294}
295295
296- void QuicSessionListener::OnSessionClose (QuicError error) {
296+ void QuicSessionListener::OnSessionClose (QuicError error, int flags ) {
297297 if (previous_listener_ != nullptr )
298- previous_listener_->OnSessionClose (error);
298+ previous_listener_->OnSessionClose (error, flags );
299299}
300300
301301void QuicSessionListener::OnStreamReady (BaseObjectPtr<QuicStream> stream) {
@@ -328,13 +328,6 @@ void QuicSessionListener::OnStreamBlocked(int64_t stream_id) {
328328 }
329329}
330330
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-
338331void QuicSessionListener::OnUsePreferredAddress (
339332 int family,
340333 const PreferredAddress& preferred_address) {
@@ -525,14 +518,20 @@ void JSQuicSessionListener::OnSessionDestroyed() {
525518 env->quic_on_session_destroyed_function (), 0 , nullptr );
526519}
527520
528- void JSQuicSessionListener::OnSessionClose (QuicError error) {
521+ void JSQuicSessionListener::OnSessionClose (QuicError error, int flags ) {
529522 Environment* env = session ()->env ();
530523 HandleScope scope (env->isolate ());
531524 Context::Scope context_scope (env->context ());
532525
533526 Local<Value> argv[] = {
534527 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 ())
536535 };
537536
538537 // Grab a shared pointer to this to prevent the QuicSession
@@ -664,26 +663,6 @@ void JSQuicSessionListener::OnSessionTicket(int size, SSL_SESSION* sess) {
664663 arraysize (argv), argv);
665664}
666665
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-
687666void JSQuicSessionListener::OnUsePreferredAddress (
688667 int family,
689668 const PreferredAddress& preferred_address) {
@@ -2377,7 +2356,10 @@ void QuicSession::SilentClose() {
23772356 err.code ,
23782357 is_stateless_reset () ? " yes" : " no" );
23792358
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);
23812363}
23822364// Begin connection close by serializing the CONNECTION_CLOSE packet.
23832365// There are two variants: one to serialize an application close, the
0 commit comments