Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/async-wrap-inl.h4
-rw-r--r--src/async-wrap.cc2
-rw-r--r--src/env-inl.h9
-rw-r--r--src/env.h4
4 files changed, 18 insertions, 1 deletions
diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h
index 647a381e88f..6b434c08c00 100644
--- a/src/async-wrap-inl.h
+++ b/src/async-wrap-inl.h
@@ -21,7 +21,9 @@ inline AsyncWrap::AsyncWrap(Environment* env,
has_async_queue_(false),
provider_type_(provider) {
// Check user controlled flag to see if the init callback should run.
- if (!env->call_async_init_hook())
+ if (!env->using_asyncwrap())
+ return;
+ if (!env->call_async_init_hook() && parent != nullptr)
return;
// TODO(trevnorris): Until it's verified all passed object's are not weak,
diff --git a/src/async-wrap.cc b/src/async-wrap.cc
index eee020b788a..3ee97f6a820 100644
--- a/src/async-wrap.cc
+++ b/src/async-wrap.cc
@@ -48,6 +48,8 @@ static void SetupHooks(const FunctionCallbackInfo<Value>& args) {
env->set_async_hooks_init_function(args[1].As<Function>());
env->set_async_hooks_pre_function(args[2].As<Function>());
env->set_async_hooks_post_function(args[3].As<Function>());
+
+ env->set_using_asyncwrap(true);
}
diff --git a/src/env-inl.h b/src/env-inl.h
index 46267ebd57d..ac97f8ea172 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -165,6 +165,7 @@ inline Environment::Environment(v8::Local<v8::Context> context,
isolate_data_(IsolateData::GetOrCreate(context->GetIsolate(), loop)),
using_smalloc_alloc_cb_(false),
using_domains_(false),
+ using_asyncwrap_(false),
printed_error_(false),
debugger_agent_(this),
context_(context->GetIsolate(), context) {
@@ -298,6 +299,14 @@ inline void Environment::set_using_domains(bool value) {
using_domains_ = value;
}
+inline bool Environment::using_asyncwrap() const {
+ return using_asyncwrap_;
+}
+
+inline void Environment::set_using_asyncwrap(bool value) {
+ using_asyncwrap_ = value;
+}
+
inline bool Environment::printed_error() const {
return printed_error_;
}
diff --git a/src/env.h b/src/env.h
index 8dc9c968835..f28d5ffad2a 100644
--- a/src/env.h
+++ b/src/env.h
@@ -395,6 +395,9 @@ class Environment {
inline bool using_domains() const;
inline void set_using_domains(bool value);
+ inline bool using_asyncwrap() const;
+ inline void set_using_asyncwrap(bool value);
+
inline bool printed_error() const;
inline void set_printed_error(bool value);
@@ -479,6 +482,7 @@ class Environment {
ares_task_list cares_task_list_;
bool using_smalloc_alloc_cb_;
bool using_domains_;
+ bool using_asyncwrap_;
bool printed_error_;
debugger::Agent debugger_agent_;