summaryrefslogtreecommitdiff
path: root/lib/_http_client.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-03-05 12:20:48 +0100
committerAnatoli Papirovski <apapirovski@mac.com>2018-03-08 13:23:44 +0100
commit4d074343ddf674817b8479896bfdce5ae23a83e8 (patch)
treebceb875819220e1bf33ecc7428777a1c267f820d /lib/_http_client.js
parent64d523411f4a87e4f27624f83590341eb3693cef (diff)
downloadandroid-node-v8-4d074343ddf674817b8479896bfdce5ae23a83e8.tar.gz
android-node-v8-4d074343ddf674817b8479896bfdce5ae23a83e8.tar.bz2
android-node-v8-4d074343ddf674817b8479896bfdce5ae23a83e8.zip
async_hooks,process: remove internalNextTick
Instead of having mostly duplicate code in form of internalNextTick, instead use the existing defaultAsyncTriggerIdScope with a slight modification which allows undefined triggerAsyncId to be passed in, which then just triggers the callback with the provided arguments. PR-URL: https://github.com/nodejs/node/pull/19147 Refs: https://github.com/nodejs/node/issues/19104 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r--lib/_http_client.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js
index 3687288ee8..8e3d61a756 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -36,9 +36,9 @@ const {
const { OutgoingMessage } = require('_http_outgoing');
const Agent = require('_http_agent');
const { Buffer } = require('buffer');
+const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
const { urlToOptions, searchParamsSymbol } = require('internal/url');
const { outHeadersKey, ondrain } = require('internal/http');
-const { nextTick } = require('internal/process/next_tick');
const {
ERR_HTTP_HEADERS_SENT,
ERR_INVALID_ARG_TYPE,
@@ -563,10 +563,10 @@ function responseKeepAlive(res, req) {
socket.once('error', freeSocketErrorListener);
// There are cases where _handle === null. Avoid those. Passing null to
// nextTick() will call getDefaultTriggerAsyncId() to retrieve the id.
- const asyncId = socket._handle ? socket._handle.getAsyncId() : null;
+ const asyncId = socket._handle ? socket._handle.getAsyncId() : undefined;
// Mark this socket as available, AFTER user-added end
// handlers have a chance to run.
- nextTick(asyncId, emitFreeNT, socket);
+ defaultTriggerAsyncIdScope(asyncId, process.nextTick, emitFreeNT, socket);
}
}