diff --git a/lib/net.js b/lib/net.js index 0c12ff72aa3c50..9f40b21efaabe0 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1476,7 +1476,7 @@ function lookupAndConnectMultiple( const context = { socket: self, - addresses, + addresses: toAttempt, current: 0, port, localPort, diff --git a/test/parallel/test-net-autoselectfamily.js b/test/parallel/test-net-autoselectfamily.js index d1440951eea6d0..3cce88f9ce907e 100644 --- a/test/parallel/test-net-autoselectfamily.js +++ b/test/parallel/test-net-autoselectfamily.js @@ -117,7 +117,7 @@ function createDnsServer(ipv6Addrs, ipv4Addrs, cb) { // Test that only the last successful connection is established. { createDnsServer( - '::1', + ['2606:4700::6810:85e5', '2606:4700::6810:84e5', '::1'], ['104.20.22.46', '104.20.23.46', '127.0.0.1'], common.mustCall(function({ dnsServer, lookup }) { const ipv4Server = createServer((socket) => { @@ -144,7 +144,14 @@ function createDnsServer(ipv6Addrs, ipv4Addrs, cb) { connection.on('ready', common.mustCall(() => { assert.deepStrictEqual( connection.autoSelectFamilyAttemptedAddresses, - [`::1:${port}`, `104.20.22.46:${port}`, `104.20.23.46:${port}`, `127.0.0.1:${port}`] + [ + `2606:4700::6810:85e5:${port}`, + `104.20.22.46:${port}`, + `2606:4700::6810:84e5:${port}`, + `104.20.23.46:${port}`, + `::1:${port}`, + `127.0.0.1:${port}`, + ] ); }));