()
| 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(); |
no test coverage detected
searching dependent graphs…