MCPcopy Index your code
hub / github.com/nodejs/node / execAndClose

Function execAndClose

test/sequential/test-http-regr-gh-2928.js:22–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20let gotResponses = 0;
21
22function execAndClose() {
23 if (parsers.length === 0)
24 return;
25 process.stdout.write('.');
26
27 const parser = parsers.pop();
28 parser.initialize(HTTPParser.RESPONSE, {});
29
30 const socket = net.connect(common.PORT, common.localhostIPv4);
31 socket.on('error', (e) => {
32 // If SmartOS and ECONNREFUSED, then retry. See
33 // https://github.com/nodejs/node/issues/2663.
34 if (common.isSunOS && e.code === 'ECONNREFUSED') {
35 parsers.push(parser);
36 parser.reused = true;
37 socket.destroy();
38 setImmediate(execAndClose);
39 return;
40 }
41 throw e;
42 });
43
44 parser.consume(socket._handle);
45
46 parser.onIncoming = function onIncoming() {
47 process.stdout.write('+');
48 gotResponses++;
49 parser.unconsume();
50 httpCommon.freeParser(parser);
51 socket.destroy();
52 setImmediate(execAndClose);
53 };
54}
55
56const server = net.createServer(function(c) {
57 if (++gotRequests === COUNT)

Callers

nothing calls this directly

Calls 10

popMethod · 0.80
unconsumeMethod · 0.80
connectMethod · 0.65
setImmediateFunction · 0.50
writeMethod · 0.45
initializeMethod · 0.45
onMethod · 0.45
pushMethod · 0.45
destroyMethod · 0.45
consumeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…