mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
net: enable autoSelectFamily by default
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/46790 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
parent
069365c5bd
commit
8b51c1a869
22 changed files with 147 additions and 94 deletions
|
@ -7,8 +7,11 @@ const c = net.createConnection(common.PORT);
|
|||
|
||||
c.on('connect', common.mustNotCall());
|
||||
|
||||
c.on('error', common.mustCall(function(e) {
|
||||
assert.strictEqual(e.code, 'ECONNREFUSED');
|
||||
assert.strictEqual(e.port, common.PORT);
|
||||
assert.match(e.address, /^(127\.0\.0\.1|::1)$/);
|
||||
c.on('error', common.mustCall(function(error) {
|
||||
// Family autoselection might be skipped if only a single address is returned by DNS.
|
||||
const failedAttempt = Array.isArray(error.errors) ? error.errors[0] : error;
|
||||
|
||||
assert.strictEqual(failedAttempt.code, 'ECONNREFUSED');
|
||||
assert.strictEqual(failedAttempt.port, common.PORT);
|
||||
assert.match(failedAttempt.address, /^(127\.0\.0\.1|::1)$/);
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue