0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-dgram-reuseport.js
Luigi Pinca 84fe809535
test: remove unneeded listeners
Unhandled `'error'` events will make the process exit with an unclean
exit code anyway.

PR-URL: https://github.com/nodejs/node/pull/55486
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
2024-10-29 21:52:09 +00:00

20 lines
542 B
JavaScript

'use strict';
const common = require('../common');
const { checkSupportReusePort, options } = require('../common/udp');
const dgram = require('dgram');
function test() {
const socket1 = dgram.createSocket(options);
const socket2 = dgram.createSocket(options);
socket1.bind(0, common.mustCall(() => {
socket2.bind(socket1.address().port, common.mustCall(() => {
socket1.close();
socket2.close();
}));
}));
}
checkSupportReusePort().then(test, () => {
common.skip('The `reusePort` option is not supported');
});