summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-03-19 08:17:26 -0700
committerJames M Snell <jasnell@gmail.com>2018-03-22 13:48:41 -0700
commitab755484a8a5113cb6d74f8e8ae5a26c44ae4582 (patch)
treeaa28b392c155c4ba223c0742e67e3191fce86a93 /lib
parente714da6f0abdf0b7c1d78be364ca7342246da74f (diff)
downloadandroid-node-v8-ab755484a8a5113cb6d74f8e8ae5a26c44ae4582.tar.gz
android-node-v8-ab755484a8a5113cb6d74f8e8ae5a26c44ae4582.tar.bz2
android-node-v8-ab755484a8a5113cb6d74f8e8ae5a26c44ae4582.zip
http2: remove some unnecessary next ticks
PR-URL: https://github.com/nodejs/node/pull/19451 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/http2/core.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index 9315474364..fc73eccdad 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -409,7 +409,7 @@ function onSettings() {
session[kUpdateTimer]();
debug(`Http2Session ${sessionName(session[kType])}: new settings received`);
session[kRemoteSettings] = undefined;
- process.nextTick(emit, session, 'remoteSettings', session.remoteSettings);
+ session.emit('remoteSettings', session.remoteSettings);
}
// If the stream exists, an attempt will be made to emit an event
@@ -425,7 +425,7 @@ function onPriority(id, parent, weight, exclusive) {
const emitter = session[kState].streams.get(id) || session;
if (!emitter.destroyed) {
emitter[kUpdateTimer]();
- process.nextTick(emit, emitter, 'priority', id, parent, weight, exclusive);
+ emitter.emit('priority', id, parent, weight, exclusive);
}
}
@@ -439,7 +439,7 @@ function onFrameError(id, type, code) {
`type ${type} on stream ${id}, code: ${code}`);
const emitter = session[kState].streams.get(id) || session;
emitter[kUpdateTimer]();
- process.nextTick(emit, emitter, 'frameError', type, code, id);
+ emitter.emit('frameError', type, code, id);
}
function onAltSvc(stream, origin, alt) {
@@ -449,7 +449,7 @@ function onAltSvc(stream, origin, alt) {
debug(`Http2Session ${sessionName(session[kType])}: altsvc received: ` +
`stream: ${stream}, origin: ${origin}, alt: ${alt}`);
session[kUpdateTimer]();
- process.nextTick(emit, session, 'altsvc', alt, origin, stream);
+ session.emit('altsvc', alt, origin, stream);
}
// Receiving a GOAWAY frame from the connected peer is a signal that no
@@ -771,7 +771,7 @@ function setupHandle(socket, type, options) {
// core will check for session.destroyed before progressing, this
// ensures that those at l`east get cleared out.
if (this.destroyed) {
- process.nextTick(emit, this, 'connect', this, socket);
+ this.emit('connect', this, socket);
return;
}
debug(`Http2Session ${sessionName(type)}: setting up session handle`);
@@ -813,7 +813,7 @@ function setupHandle(socket, type, options) {
options.settings : {};
this.settings(settings);
- process.nextTick(emit, this, 'connect', this, socket);
+ this.emit('connect', this, socket);
}
// Emits a close event followed by an error event if err is truthy. Used
@@ -1262,7 +1262,7 @@ class Http2Session extends EventEmitter {
}
}
- process.nextTick(emit, this, 'timeout');
+ this.emit('timeout');
}
ref() {
@@ -1485,8 +1485,8 @@ function streamOnPause() {
function abort(stream) {
if (!stream.aborted &&
!(stream._writableState.ended || stream._writableState.ending)) {
- process.nextTick(emit, stream, 'aborted');
stream[kState].flags |= STREAM_FLAGS_ABORTED;
+ stream.emit('aborted');
}
}
@@ -1612,7 +1612,7 @@ class Http2Stream extends Duplex {
}
}
- process.nextTick(emit, this, 'timeout');
+ this.emit('timeout');
}
// true if the HEADERS frame has been sent