blob: dc05d70c81f80e6ef4bbac61b2b882451209563a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
'use strict';
require('../common');
process.env.NODE_CLUSTER_SCHED_POLICY = 'none';
const cluster = require('cluster');
const net = require('net');
if (cluster.isMaster) {
const unbound = cluster.fork().on('online', bind);
function bind() {
cluster.fork({BOUND: 'y'}).on('listening', disconnect);
}
function disconnect() {
unbound.disconnect();
unbound.on('disconnect', cluster.disconnect);
}
} else {
if (process.env.BOUND === 'y') {
const source = net.createServer();
source.listen(0);
}
}
|