@@ -288,21 +288,6 @@ function onSessionClose(code, family, silent, statelessReset) {
288
288
this [ owner_symbol ] [ kDestroy ] ( code , family , silent , statelessReset ) ;
289
289
}
290
290
291
- // Called by the C++ internals when a QuicSession has been destroyed.
292
- // When this is called, the QuicSession is no longer usable. Removing
293
- // the handle and emitting close is the only action.
294
- // TODO(@jasnell): In the future, this will need to act differently
295
- // for QuicClientSessions when autoResume is enabled.
296
- function onSessionDestroyed ( ) {
297
- const session = this [ owner_symbol ] ;
298
- this [ owner_symbol ] = undefined ;
299
-
300
- if ( session ) {
301
- session [ kSetHandle ] ( ) ;
302
- process . nextTick ( emit . bind ( session , 'close' ) ) ;
303
- }
304
- }
305
-
306
291
// Used only within the onSessionClientHello function. Invoked
307
292
// to complete the client hello process.
308
293
function clientHelloCallback ( err , ...args ) {
@@ -558,7 +543,6 @@ setCallbacks({
558
543
onSessionCert,
559
544
onSessionClientHello,
560
545
onSessionClose,
561
- onSessionDestroyed,
562
546
onSessionHandshake,
563
547
onSessionKeylog,
564
548
onSessionQlog,
@@ -1908,28 +1892,26 @@ class QuicSession extends EventEmitter {
1908
1892
this . removeListener ( 'newListener' , onNewListener ) ;
1909
1893
this . removeListener ( 'removeListener' , onRemoveListener ) ;
1910
1894
1911
- // If we are destroying with an error, schedule the
1912
- // error to be emitted on process.nextTick.
1913
- if ( error ) process . nextTick ( emit . bind ( this , 'error' , error ) ) ;
1914
-
1915
1895
const handle = this [ kHandle ] ;
1916
- this [ kHandle ] = undefined ;
1917
-
1896
+ this [ kHandle ] = undefined
1918
1897
if ( handle !== undefined ) {
1919
1898
// Copy the stats for use after destruction
1920
1899
state . stats = new BigInt64Array ( handle . stats ) ;
1921
1900
state . idleTimeout = this [ kInternalState ] . state . idleTimeout ;
1922
1901
1923
1902
// Destroy the underlying QuicSession handle
1924
1903
handle . destroy ( state . closeCode , state . closeFamily ) ;
1925
- } else {
1926
- process . nextTick ( emit . bind ( this , 'close' ) ) ;
1927
1904
}
1928
1905
1929
1906
// Remove the QuicSession JavaScript object from the
1930
1907
// associated QuicSocket.
1931
1908
state . socket [ kRemoveSession ] ( this ) ;
1932
1909
state . socket = undefined ;
1910
+
1911
+ // If we are destroying with an error, schedule the
1912
+ // error to be emitted on process.nextTick.
1913
+ if ( error ) process . nextTick ( emit . bind ( this , 'error' , error ) ) ;
1914
+ process . nextTick ( emit . bind ( this , 'close' ) ) ;
1933
1915
}
1934
1916
1935
1917
// For server QuicSession instances, true if earlyData is
0 commit comments