mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
7202859402
Setting the `maxConnections` to 0 should result in no connection. Instead, it was treated as if the option was not there. PR-URL: https://github.com/nodejs/node/pull/48276 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
let firstSocket;
|
|
const dormantServer = net.createServer(common.mustNotCall());
|
|
const server = net.createServer(common.mustCall((socket) => {
|
|
firstSocket = socket;
|
|
}));
|
|
|
|
dormantServer.maxConnections = 0;
|
|
server.maxConnections = 1;
|
|
|
|
dormantServer.on('drop', common.mustCall((data) => {
|
|
assert.strictEqual(!!data.localAddress, true);
|
|
assert.strictEqual(!!data.localPort, true);
|
|
assert.strictEqual(!!data.remoteAddress, true);
|
|
assert.strictEqual(!!data.remotePort, true);
|
|
assert.strictEqual(!!data.remoteFamily, true);
|
|
dormantServer.close();
|
|
}));
|
|
|
|
server.on('drop', common.mustCall((data) => {
|
|
assert.strictEqual(!!data.localAddress, true);
|
|
assert.strictEqual(!!data.localPort, true);
|
|
assert.strictEqual(!!data.remoteAddress, true);
|
|
assert.strictEqual(!!data.remotePort, true);
|
|
assert.strictEqual(!!data.remoteFamily, true);
|
|
firstSocket.destroy();
|
|
server.close();
|
|
}));
|
|
|
|
dormantServer.listen(0, () => {
|
|
net.createConnection(dormantServer.address().port);
|
|
});
|
|
|
|
server.listen(0, () => {
|
|
net.createConnection(server.address().port);
|
|
net.createConnection(server.address().port);
|
|
});
|