mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: remove common.PORT from test-net-timeout
Switch test-net-timeout from common.PORT to a port assigned by the operating system. PR-URL: https://github.com/nodejs/node/pull/31749 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
fab3eff2e5
commit
794bfacb26
@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const net = require('net');
|
||||
|
||||
@ -54,10 +54,11 @@ const echo_server = net.createServer((socket) => {
|
||||
});
|
||||
});
|
||||
|
||||
echo_server.listen(common.PORT, () => {
|
||||
console.log(`server listening at ${common.PORT}`);
|
||||
echo_server.listen(0, () => {
|
||||
const port = echo_server.address().port;
|
||||
console.log(`server listening at ${port}`);
|
||||
|
||||
const client = net.createConnection(common.PORT);
|
||||
const client = net.createConnection(port);
|
||||
client.setEncoding('UTF8');
|
||||
client.setTimeout(0); // Disable the timeout for client
|
||||
client.on('connect', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user