summaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-rr-ref.js
blob: cf5e4f346bf7e2c40ce2db2476031b74615a8513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'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');
    });
  });
}