@@ -364,7 +364,7 @@ function onSettings() {
364
364
session [ kUpdateTimer ] ( ) ;
365
365
debug ( `Http2Session ${ sessionName ( session [ kType ] ) } : new settings received` ) ;
366
366
session [ kRemoteSettings ] = undefined ;
367
- process . nextTick ( emit , session , 'remoteSettings' , session . remoteSettings ) ;
367
+ session . emit ( 'remoteSettings' , session . remoteSettings ) ;
368
368
}
369
369
370
370
// If the stream exists, an attempt will be made to emit an event
@@ -380,7 +380,7 @@ function onPriority(id, parent, weight, exclusive) {
380
380
const emitter = session [ kState ] . streams . get ( id ) || session ;
381
381
if ( ! emitter . destroyed ) {
382
382
emitter [ kUpdateTimer ] ( ) ;
383
- process . nextTick ( emit , emitter , 'priority' , id , parent , weight , exclusive ) ;
383
+ emitter . emit ( 'priority' , id , parent , weight , exclusive ) ;
384
384
}
385
385
}
386
386
@@ -394,7 +394,7 @@ function onFrameError(id, type, code) {
394
394
`type ${ type } on stream ${ id } , code: ${ code } ` ) ;
395
395
const emitter = session [ kState ] . streams . get ( id ) || session ;
396
396
emitter [ kUpdateTimer ] ( ) ;
397
- process . nextTick ( emit , emitter , 'frameError' , type , code , id ) ;
397
+ emitter . emit ( 'frameError' , type , code , id ) ;
398
398
}
399
399
400
400
function onAltSvc ( stream , origin , alt ) {
@@ -404,7 +404,7 @@ function onAltSvc(stream, origin, alt) {
404
404
debug ( `Http2Session ${ sessionName ( session [ kType ] ) } : altsvc received: ` +
405
405
`stream: ${ stream } , origin: ${ origin } , alt: ${ alt } ` ) ;
406
406
session [ kUpdateTimer ] ( ) ;
407
- process . nextTick ( emit , session , 'altsvc' , alt , origin , stream ) ;
407
+ session . emit ( 'altsvc' , alt , origin , stream ) ;
408
408
}
409
409
410
410
// Receiving a GOAWAY frame from the connected peer is a signal that no
@@ -734,7 +734,7 @@ function setupHandle(socket, type, options) {
734
734
// core will check for session.destroyed before progressing, this
735
735
// ensures that those at l`east get cleared out.
736
736
if ( this . destroyed ) {
737
- process . nextTick ( emit , this , 'connect' , this , socket ) ;
737
+ this . emit ( 'connect' , this , socket ) ;
738
738
return ;
739
739
}
740
740
debug ( `Http2Session ${ sessionName ( type ) } : setting up session handle` ) ;
@@ -776,7 +776,7 @@ function setupHandle(socket, type, options) {
776
776
options . settings : { } ;
777
777
778
778
this . settings ( settings ) ;
779
- process . nextTick ( emit , this , 'connect' , this , socket ) ;
779
+ this . emit ( 'connect' , this , socket ) ;
780
780
}
781
781
782
782
// Emits a close event followed by an error event if err is truthy. Used
@@ -1227,7 +1227,7 @@ class Http2Session extends EventEmitter {
1227
1227
}
1228
1228
}
1229
1229
1230
- process . nextTick ( emit , this , 'timeout' ) ;
1230
+ this . emit ( 'timeout' ) ;
1231
1231
}
1232
1232
1233
1233
ref ( ) {
@@ -1455,8 +1455,8 @@ function streamOnPause() {
1455
1455
function abort ( stream ) {
1456
1456
if ( ! stream . aborted &&
1457
1457
! ( stream . _writableState . ended || stream . _writableState . ending ) ) {
1458
- process . nextTick ( emit , stream , 'aborted' ) ;
1459
1458
stream [ kState ] . flags |= STREAM_FLAGS_ABORTED ;
1459
+ stream . emit ( 'aborted' ) ;
1460
1460
}
1461
1461
}
1462
1462
@@ -1578,7 +1578,7 @@ class Http2Stream extends Duplex {
1578
1578
}
1579
1579
}
1580
1580
1581
- process . nextTick ( emit , this , 'timeout' ) ;
1581
+ this . emit ( 'timeout' ) ;
1582
1582
}
1583
1583
1584
1584
// true if the HEADERS frame has been sent
0 commit comments