From e9ac80bb397293feef3b47f3ed609c86edb48681 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sun, 11 Feb 2018 16:35:59 -0500 Subject: async_hooks: clean up usage in internal code Instead of exposing internals of async_hooks & async_wrap throughout the code base, create necessary helper methods within the internal async_hooks that allows easy usage by Node.js internals. This stops every single internal user of async_hooks from importing a ton of functions, constants and internal Aliased Buffers from C++ async_wrap. Adds functions initHooksExist, afterHooksExist, and destroyHooksExist to determine whether the related emit methods need to be triggered. Adds clearDefaultTriggerAsyncId and clearAsyncIdStack on the JS side as an alternative to always calling C++. Moves async_id_symbol and trigger_async_id_symbol to internal async_hooks as they are never used in C++. Renames newUid to newAsyncId for added clarity of its purpose. Adjusts usage throughout the codebase, as well as in a couple of tests. PR-URL: https://github.com/nodejs/node/pull/18720 Reviewed-By: James M Snell Reviewed-By: Ali Ijaz Sheikh Reviewed-By: Anna Henningsen --- lib/_http_outgoing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/_http_outgoing.js') diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 425cfbcc29..f513315b7c 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -31,7 +31,7 @@ const common = require('_http_common'); const checkIsHttpToken = common._checkIsHttpToken; const checkInvalidHeaderChar = common._checkInvalidHeaderChar; const { outHeadersKey } = require('internal/http'); -const { async_id_symbol } = process.binding('async_wrap'); +const { async_id_symbol } = require('internal/async_hooks').symbols; const { nextTick } = require('internal/process/next_tick'); const errors = require('internal/errors'); -- cgit v1.2.3