0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 08:19:38 +01:00
nodejs/test/parallel/test-cluster-disconnect-unshared-udp.js
isaacs 3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00

27 lines
583 B
JavaScript

if (process.platform === 'win32') {
console.log('skipping test on windows, where clustered dgram is ENOTSUP');
process.exit(0);
}
var cluster = require('cluster');
var dgram = require('dgram');
if (cluster.isMaster) {
var 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') {
var source = dgram.createSocket('udp4');
source.bind(0);
}
}