mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -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
@@ -48,6 +48,8 @@ const { getSystemErrorName } = require('util');
|
||||
if (!common.isMainThread)
|
||||
delete providers.INSPECTORJSBINDING;
|
||||
delete providers.KEYPAIRGENREQUEST;
|
||||
delete providers.HTTPCLIENTREQUEST;
|
||||
delete providers.HTTPINCOMINGMESSAGE;
|
||||
|
||||
const objKeys = Object.keys(providers);
|
||||
if (objKeys.length > 0)
|
||||
|
||||
@@ -7,6 +7,7 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const httpCommon = require('_http_common');
|
||||
const { HTTPParser } = require('_http_common');
|
||||
const { AsyncResource } = require('async_hooks');
|
||||
const net = require('net');
|
||||
|
||||
const COUNT = httpCommon.parsers.max + 1;
|
||||
@@ -24,7 +25,7 @@ function execAndClose() {
|
||||
process.stdout.write('.');
|
||||
|
||||
const parser = parsers.pop();
|
||||
parser.reinitialize(HTTPParser.RESPONSE, !!parser.reused);
|
||||
parser.initialize(HTTPParser.RESPONSE, new AsyncResource('ClientRequest'));
|
||||
|
||||
const socket = net.connect(common.PORT);
|
||||
socket.on('error', (e) => {
|
||||
|
||||
Reference in new issue
Block a user