mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
84fe809535
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>
25 lines
651 B
JavaScript
25 lines
651 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const { checkSupportReusePort, options } = require('../common/net');
|
|
const net = require('net');
|
|
|
|
function test(host) {
|
|
const server1 = net.createServer();
|
|
const server2 = net.createServer();
|
|
server1.listen({ ...options, host }, common.mustCall(() => {
|
|
const port = server1.address().port;
|
|
server2.listen({ ...options, host, port }, common.mustCall(() => {
|
|
server1.close();
|
|
server2.close();
|
|
}));
|
|
}));
|
|
}
|
|
|
|
checkSupportReusePort()
|
|
.then(() => {
|
|
test('127.0.0.1');
|
|
common.hasIPv6 && test('::');
|
|
}, () => {
|
|
common.skip('The `reusePort` option is not supported');
|
|
});
|