mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
531 B
25 lines
531 B
'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);
|
|
}
|
|
}
|
|
|