summaryrefslogtreecommitdiff
path: root/lib/async_hooks.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-07-03 14:16:12 +0200
committerAndreas Madsen <amwebdk@gmail.com>2017-07-13 11:57:44 +0200
commit8a830350b226b4e56cdf3cd519e62ff8a071f9c3 (patch)
treef53a567ee74aeed723343e0fc3a1c7be7173d29a /lib/async_hooks.js
parent5ffb5b6fce376fa08be1af7552ce6d6c9e80bc56 (diff)
downloadandroid-node-v8-8a830350b226b4e56cdf3cd519e62ff8a071f9c3.tar.gz
android-node-v8-8a830350b226b4e56cdf3cd519e62ff8a071f9c3.tar.bz2
android-node-v8-8a830350b226b4e56cdf3cd519e62ff8a071f9c3.zip
async_hooks: move restoreTmpHooks call to init
This fixes an error that could occure by nesting async_hooks calls PR-URL: https://github.com/nodejs/node/pull/14054 Ref: https://github.com/nodejs/node/pull/13755#issuecomment-312616004 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Diffstat (limited to 'lib/async_hooks.js')
-rw-r--r--lib/async_hooks.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/async_hooks.js b/lib/async_hooks.js
index a730738c0f..42d04f0630 100644
--- a/lib/async_hooks.js
+++ b/lib/async_hooks.js
@@ -335,11 +335,6 @@ function emitInitS(asyncId, type, triggerAsyncId, resource) {
throw new RangeError('triggerAsyncId must be an unsigned integer');
init(asyncId, type, triggerAsyncId, resource);
-
- // Isn't null if hooks were added/removed while the hooks were running.
- if (tmp_active_hooks_array !== null) {
- restoreTmpHooks();
- }
}
function emitHookFactory(symbol, name) {
@@ -442,6 +437,11 @@ function init(asyncId, type, triggerAsyncId, resource) {
fatalError(e);
}
processing_hook = false;
+
+ // Isn't null if hooks were added/removed while the hooks were running.
+ if (tmp_active_hooks_array !== null) {
+ restoreTmpHooks();
+ }
}