0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/parallel/test-cluster-disconnect-unshared-tcp.js
Rachel 0f7fffb329 test: cleanup cluster-disconnect-unshared-tcp test
Replaced var with const

PR-URL: https://github.com/nodejs/node/pull/8598
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2016-09-20 19:11:56 +03:00

26 lines
531 B
JavaScript

'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);
}
}