0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-cluster-rr-ref.js
Tarun Batra 2e5188de92 test: remove common.PORT from multiple tests
PR-URL: https://github.com/nodejs/node/pull/12451
Ref: https://github.com/nodejs/node/issues/12376
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-18 08:07:04 -07:00

21 lines
441 B
JavaScript

'use strict';
const common = require('../common');
const cluster = require('cluster');
const net = require('net');
if (cluster.isMaster) {
cluster.fork().on('message', function(msg) {
if (msg === 'done') this.kill();
});
} else {
const server = net.createServer(common.mustNotCall());
server.listen(0, function() {
server.unref();
server.ref();
server.close(function() {
process.send('done');
});
});
}