@@ -361,7 +361,7 @@ function onSettings() {
361
361
session [ kUpdateTimer ] ( ) ;
362
362
debug ( `Http2Session ${ sessionName ( session [ kType ] ) } : new settings received` ) ;
363
363
session [ kRemoteSettings ] = undefined ;
364
- process . nextTick ( emit , session , 'remoteSettings' , session . remoteSettings ) ;
364
+ session . emit ( 'remoteSettings' , session . remoteSettings ) ;
365
365
}
366
366
367
367
// If the stream exists, an attempt will be made to emit an event
@@ -377,7 +377,7 @@ function onPriority(id, parent, weight, exclusive) {
377
377
const emitter = session [ kState ] . streams . get ( id ) || session ;
378
378
if ( ! emitter . destroyed ) {
379
379
emitter [ kUpdateTimer ] ( ) ;
380
- process . nextTick ( emit , emitter , 'priority' , id , parent , weight , exclusive ) ;
380
+ emitter . emit ( 'priority' , id , parent , weight , exclusive ) ;
381
381
}
382
382
}
383
383
@@ -391,7 +391,7 @@ function onFrameError(id, type, code) {
391
391
`type ${ type } on stream ${ id } , code: ${ code } ` ) ;
392
392
const emitter = session [ kState ] . streams . get ( id ) || session ;
393
393
emitter [ kUpdateTimer ] ( ) ;
394
- process . nextTick ( emit , emitter , 'frameError' , type , code , id ) ;
394
+ emitter . emit ( 'frameError' , type , code , id ) ;
395
395
}
396
396
397
397
function onAltSvc ( stream , origin , alt ) {
@@ -401,7 +401,7 @@ function onAltSvc(stream, origin, alt) {
401
401
debug ( `Http2Session ${ sessionName ( session [ kType ] ) } : altsvc received: ` +
402
402
`stream: ${ stream } , origin: ${ origin } , alt: ${ alt } ` ) ;
403
403
session [ kUpdateTimer ] ( ) ;
404
- process . nextTick ( emit , session , 'altsvc' , alt , origin , stream ) ;
404
+ session . emit ( 'altsvc' , alt , origin , stream ) ;
405
405
}
406
406
407
407
// Receiving a GOAWAY frame from the connected peer is a signal that no
@@ -731,7 +731,7 @@ function setupHandle(socket, type, options) {
731
731
// core will check for session.destroyed before progressing, this
732
732
// ensures that those at l`east get cleared out.
733
733
if ( this . destroyed ) {
734
- process . nextTick ( emit , this , 'connect' , this , socket ) ;
734
+ this . emit ( 'connect' , this , socket ) ;
735
735
return ;
736
736
}
737
737
debug ( `Http2Session ${ sessionName ( type ) } : setting up session handle` ) ;
@@ -773,7 +773,7 @@ function setupHandle(socket, type, options) {
773
773
options . settings : { } ;
774
774
775
775
this . settings ( settings ) ;
776
- process . nextTick ( emit , this , 'connect' , this , socket ) ;
776
+ this . emit ( 'connect' , this , socket ) ;
777
777
}
778
778
779
779
// Emits a close event followed by an error event if err is truthy. Used
@@ -1224,7 +1224,7 @@ class Http2Session extends EventEmitter {
1224
1224
}
1225
1225
}
1226
1226
1227
- process . nextTick ( emit , this , 'timeout' ) ;
1227
+ this . emit ( 'timeout' ) ;
1228
1228
}
1229
1229
1230
1230
ref ( ) {
@@ -1452,8 +1452,8 @@ function streamOnPause() {
1452
1452
function abort ( stream ) {
1453
1453
if ( ! stream . aborted &&
1454
1454
! ( stream . _writableState . ended || stream . _writableState . ending ) ) {
1455
- process . nextTick ( emit , stream , 'aborted' ) ;
1456
1455
stream [ kState ] . flags |= STREAM_FLAGS_ABORTED ;
1456
+ stream . emit ( 'aborted' ) ;
1457
1457
}
1458
1458
}
1459
1459
@@ -1575,7 +1575,7 @@ class Http2Stream extends Duplex {
1575
1575
}
1576
1576
}
1577
1577
1578
- process . nextTick ( emit , this , 'timeout' ) ;
1578
+ this . emit ( 'timeout' ) ;
1579
1579
}
1580
1580
1581
1581
// true if the HEADERS frame has been sent
0 commit comments