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

Function closeSockets

test/parallel/test-child-process-fork-getconnections.js:90–106  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

88
89 let subprocessKilled = false;
90 function closeSockets(i) {
91 if (i === count) {
92 subprocessKilled = true;
93 server.close();
94 child.kill();
95 return;
96 }
97
98 child.once('message', common.mustCall((m) => {
99 assert.strictEqual(m.status, 'closed');
100 server.getConnections(common.mustSucceed((num) => {
101 assert.strictEqual(num, count - (i + 1));
102 closeSockets(i + 1);
103 }));
104 }));
105 child.send({ id: i, cmd: 'close' });
106 }
107
108 server.on('close', common.mustCall());
109

Calls 5

killMethod · 0.80
getConnectionsMethod · 0.80
closeMethod · 0.65
sendMethod · 0.65
onceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…