mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
20525f14b9
PR-URL: https://github.com/nodejs/node/pull/52056 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
22 lines
704 B
JavaScript
22 lines
704 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
const cluster = require('cluster');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap');
|
|
|
|
// Test if the worker can listen with handle successfully
|
|
if (cluster.isPrimary) {
|
|
cluster.fork();
|
|
} else {
|
|
const handle = new TCP(TCPConstants.SOCKET);
|
|
const errno = handle.bind('0.0.0.0', 0);
|
|
assert.strictEqual(errno, 0);
|
|
// Execute _listen2 instead of cluster._getServer in listenInCluster
|
|
net.createServer().listen(handle, common.mustCall(() => {
|
|
process.exit(0);
|
|
}));
|
|
}
|