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

Function shoot

test/parallel/test-tls-ticket-cluster.js:47–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 let workerPort = null;
46
47 function shoot() {
48 console.error('[primary] connecting',
49 workerPort, 'session?', !!lastSession);
50 const c = tls.connect(workerPort, {
51 session: lastSession,
52 rejectUnauthorized: false
53 }, () => {
54 c.on('end', c.end);
55 }).on('close', () => {
56 // Wait for close to shoot off another connection. We don't want to shoot
57 // until a new session is allocated, if one will be. The new session is
58 // not guaranteed on secureConnect (it depends on TLS1.2 vs TLS1.3), but
59 // it is guaranteed to happen before the connection is closed.
60 if (++reqCount === expectedReqCount) {
61 Object.keys(cluster.workers).forEach(function(id) {
62 cluster.workers[id].send('die');
63 });
64 } else {
65 shoot();
66 }
67 }).once('session', common.mustCallAtLeast((session) => {
68 assert(!lastSession);
69 lastSession = session;
70 }, 0));
71
72 c.resume(); // See close_notify comment in server
73 }
74
75 function fork() {
76 const worker = cluster.fork();

Callers 1

forkFunction · 0.85

Calls 9

connectMethod · 0.65
forEachMethod · 0.65
keysMethod · 0.65
sendMethod · 0.65
resumeMethod · 0.65
assertFunction · 0.50
errorMethod · 0.45
onceMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…