node/test/parallel/test-dgram-unref-in-cluster.js
theanarkh 6d49f46b48
dgram: sync the old handle state to new handle
PR-URL: https://github.com/nodejs/node/pull/46041
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2023-01-03 06:28:08 +00:00

24 lines
617 B
JavaScript

'use strict';
const common = require('../common');
const dgram = require('dgram');
const cluster = require('cluster');
const assert = require('assert');
if (common.isWindows)
common.skip('dgram clustering is currently not supported on Windows.');
if (cluster.isPrimary) {
cluster.fork();
} else {
const socket = dgram.createSocket('udp4');
socket.unref();
socket.bind();
socket.on('listening', common.mustCall(() => {
const sockets = process.getActiveResourcesInfo().filter((item) => {
return item === 'UDPWrap';
});
assert.ok(sockets.length === 0);
process.disconnect();
}));
}