-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async_wrap: correctly pass parent to init callback #3216
Conversation
// Cannot assert in init callback or will abort. | ||
process.nextTick(() => { | ||
assert.equal(parent, server._handle, 'server doesn\'t match parent'); | ||
assert.equal(this, client._handle, 'client doesn\t match context'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: doesn\'t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah whoop. thanks.
ca27d2a
to
a467235
Compare
const assert = require('assert'); | ||
const net = require('net'); | ||
const async_wrap = process.binding('async_wrap'); | ||
const providers = Object.keys(async_wrap.Providers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't seem to be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. fixed.
lgtm, /cc @thlorenz |
Previous logic didn't allow parent to propagate to the init callback properly. The fix now allows the init callback to be called and passed the parent if: - async wrap callbacks are enabled and parent exists - the init callback has been called on the parent and an init callback exists then it will be called regardless of whether async wrap callbacks are disabled. Change the init/pre/post callback checks to see if it has been properly set. This allows removal of the Environment "using_asyncwrap" variable. Pass Isolate to TryCatch instance.
a467235
to
71568ea
Compare
Previous logic didn't allow parent to propagate to the init callback properly. The fix now allows the init callback to be called and receive the parent if: - async wrap callbacks are enabled and parent exists - the init callback has been called on the parent and an init callback exists then it will be called regardless of whether async wrap callbacks are disabled. Change the init/pre/post callback checks to see if it has been properly set. This allows removal of the Environment "using_asyncwrap" variable. Pass Isolate to a TryCatch instance. Fixes: #2986 PR-URL: #3216 Reviewed-By: Rod Vagg <rod@vagg.org>
CI is green. Landed in aeee956. |
Previous logic didn't allow parent to propagate to the init callback properly. The fix now allows the init callback to be called and receive the parent if: - async wrap callbacks are enabled and parent exists - the init callback has been called on the parent and an init callback exists then it will be called regardless of whether async wrap callbacks are disabled. Change the init/pre/post callback checks to see if it has been properly set. This allows removal of the Environment "using_asyncwrap" variable. Pass Isolate to a TryCatch instance. Fixes: #2986 PR-URL: #3216 Reviewed-By: Rod Vagg <rod@vagg.org>
landed in v4.x-staging in 3eaa593 |
Previous logic didn't allow parent to propagate to the init callback
properly. The fix now allows the init callback to be called and passed
the parent if:
exists then it will be called regardless of whether async wrap
callbacks are disabled.
Change the init/pre/post callback checks to see if it has been properly
set. This allows removal of the Environment "using_asyncwrap" variable.
Pass Isolate to TryCatch instance.
R=@bnoordhuis
CI: https://ci.nodejs.org/job/node-test-pull-request/428/