Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions test/sequential/test-net-connect-econnrefused.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,17 @@ let rounds = 1;
let reqs = 0;

let port;
const server = net.createServer().listen(0, common.mustCall(() => {
const server = net.createServer().listen(0, common.localhostIPv4, common.mustCall(() => {
port = server.address().port;
server.close(common.mustCall(pummel));
}));

function pummel() {
let pending;
for (pending = 0; pending < ATTEMPTS_PER_ROUND; pending++) {
net.createConnection({ port, autoSelectFamily: false }).on('error', common.mustCallAtLeast((error) => {
// Family autoselection might be skipped if only a single address is returned by DNS.
const actualError = Array.isArray(error.errors) ? error.errors[0] : error;

net.createConnection({ host: common.localhostIPv4, port }).on('error', common.mustCallAtLeast((error) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
net.createConnection({ host: common.localhostIPv4, port }).on('error', common.mustCallAtLeast((error) => {
net.createConnection({ host: common.localhostIPv4, port }).on('error', common.mustCall((error) => {

console.log('pending', pending, 'rounds', rounds);
assert.strictEqual(actualError.code, 'ECONNREFUSED');
assert.strictEqual(error.code, 'ECONNREFUSED');
if (--pending > 0) return;
if (rounds === ROUNDS) return check();
rounds++;
Expand Down
5 changes: 4 additions & 1 deletion test/sequential/test-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ function startClient() {
port: common.PORT,
method: 'GET',
path: '/',
headers: { 'content-length': buffer.length },
headers: {
'connection': 'close',
'content-length': buffer.length,
},
}, common.mustCall((res) => {
res.setEncoding('utf8');
res.on('data', common.mustCall((string) => {
Expand Down
Loading