@@ -409,7 +409,7 @@ function onSettings() {
409
409
session [ kUpdateTimer ] ( ) ;
410
410
debug ( `Http2Session ${ sessionName ( session [ kType ] ) } : new settings received` ) ;
411
411
session [ kRemoteSettings ] = undefined ;
412
- process . nextTick ( emit , session , 'remoteSettings' , session . remoteSettings ) ;
412
+ session . emit ( 'remoteSettings' , session . remoteSettings ) ;
413
413
}
414
414
415
415
// If the stream exists, an attempt will be made to emit an event
@@ -425,7 +425,7 @@ function onPriority(id, parent, weight, exclusive) {
425
425
const emitter = session [ kState ] . streams . get ( id ) || session ;
426
426
if ( ! emitter . destroyed ) {
427
427
emitter [ kUpdateTimer ] ( ) ;
428
- process . nextTick ( emit , emitter , 'priority' , id , parent , weight , exclusive ) ;
428
+ emitter . emit ( 'priority' , id , parent , weight , exclusive ) ;
429
429
}
430
430
}
431
431
@@ -439,7 +439,7 @@ function onFrameError(id, type, code) {
439
439
`type ${ type } on stream ${ id } , code: ${ code } ` ) ;
440
440
const emitter = session [ kState ] . streams . get ( id ) || session ;
441
441
emitter [ kUpdateTimer ] ( ) ;
442
- process . nextTick ( emit , emitter , 'frameError' , type , code , id ) ;
442
+ emitter . emit ( 'frameError' , type , code , id ) ;
443
443
}
444
444
445
445
function onAltSvc ( stream , origin , alt ) {
@@ -449,7 +449,7 @@ function onAltSvc(stream, origin, alt) {
449
449
debug ( `Http2Session ${ sessionName ( session [ kType ] ) } : altsvc received: ` +
450
450
`stream: ${ stream } , origin: ${ origin } , alt: ${ alt } ` ) ;
451
451
session [ kUpdateTimer ] ( ) ;
452
- process . nextTick ( emit , session , 'altsvc' , alt , origin , stream ) ;
452
+ session . emit ( 'altsvc' , alt , origin , stream ) ;
453
453
}
454
454
455
455
// Receiving a GOAWAY frame from the connected peer is a signal that no
@@ -771,7 +771,7 @@ function setupHandle(socket, type, options) {
771
771
// core will check for session.destroyed before progressing, this
772
772
// ensures that those at l`east get cleared out.
773
773
if ( this . destroyed ) {
774
- process . nextTick ( emit , this , 'connect' , this , socket ) ;
774
+ this . emit ( 'connect' , this , socket ) ;
775
775
return ;
776
776
}
777
777
debug ( `Http2Session ${ sessionName ( type ) } : setting up session handle` ) ;
@@ -813,7 +813,7 @@ function setupHandle(socket, type, options) {
813
813
options . settings : { } ;
814
814
815
815
this . settings ( settings ) ;
816
- process . nextTick ( emit , this , 'connect' , this , socket ) ;
816
+ this . emit ( 'connect' , this , socket ) ;
817
817
}
818
818
819
819
// Emits a close event followed by an error event if err is truthy. Used
@@ -1262,7 +1262,7 @@ class Http2Session extends EventEmitter {
1262
1262
}
1263
1263
}
1264
1264
1265
- process . nextTick ( emit , this , 'timeout' ) ;
1265
+ this . emit ( 'timeout' ) ;
1266
1266
}
1267
1267
1268
1268
ref ( ) {
@@ -1485,8 +1485,8 @@ function streamOnPause() {
1485
1485
function abort ( stream ) {
1486
1486
if ( ! stream . aborted &&
1487
1487
! ( stream . _writableState . ended || stream . _writableState . ending ) ) {
1488
- process . nextTick ( emit , stream , 'aborted' ) ;
1489
1488
stream [ kState ] . flags |= STREAM_FLAGS_ABORTED ;
1489
+ stream . emit ( 'aborted' ) ;
1490
1490
}
1491
1491
}
1492
1492
@@ -1612,7 +1612,7 @@ class Http2Stream extends Duplex {
1612
1612
}
1613
1613
}
1614
1614
1615
- process . nextTick ( emit , this , 'timeout' ) ;
1615
+ this . emit ( 'timeout' ) ;
1616
1616
}
1617
1617
1618
1618
// true if the HEADERS frame has been sent
0 commit comments