mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: do not reuse async resource in http parsers
Change resource being used, previously HTTParser was being reused. We are now using IncomingMessage and ClientRequest objects. The goal here is to make the async resource unique for each async operatio Refs: https://github.com/nodejs/node/pull/24330 Refs: https://github.com/nodejs/diagnostics/issues/248 Refs: https://github.com/nodejs/node/pull/21313 Co-authored-by: Matheus Marchini <mat@mmarchini.me> PR-URL: https://github.com/nodejs/node/pull/25094 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
5aaf666b3b
commit
ece507394a
13 files changed
+102
-32
No files matched your search
+6
-2
@@ -602,11 +602,15 @@ void AsyncWrap::EmitDestroy(Environment* env, double async_id) {
|
||||
env->destroy_async_id_list()->push_back(async_id);
|
||||
}
|
||||
|
||||
void AsyncWrap::AsyncReset(double execution_async_id, bool silent) {
|
||||
AsyncReset(object(), execution_async_id, silent);
|
||||
}
|
||||
|
||||
// Generalized call for both the constructor and for handles that are pooled
|
||||
// and reused over their lifetime. This way a new uid can be assigned when
|
||||
// the resource is pulled out of the pool and put back into use.
|
||||
void AsyncWrap::AsyncReset(double execution_async_id, bool silent) {
|
||||
void AsyncWrap::AsyncReset(Local<Object> resource, double execution_async_id,
|
||||
bool silent) {
|
||||
if (async_id_ != -1) {
|
||||
// This instance was in use before, we have already emitted an init with
|
||||
// its previous async_id and need to emit a matching destroy for that
|
||||
@@ -643,7 +647,7 @@ void AsyncWrap::AsyncReset(double execution_async_id, bool silent) {
|
||||
|
||||
if (silent) return;
|
||||
|
||||
EmitAsyncInit(env(), object(),
|
||||
EmitAsyncInit(env(), resource,
|
||||
env()->async_hooks()->provider_string(provider_type()),
|
||||
async_id_, trigger_async_id_);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user