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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength + 2);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ try {
buf = Buffer.allocUnsafe(kStringMaxLength * 2 + 2);
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
}

Expand Down
12 changes: 6 additions & 6 deletions test/parallel/test-http-agent-keepalive.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ function remoteClose() {
assert.strictEqual(agent.sockets[name], undefined);
assert.strictEqual(agent.freeSockets[name].length, 1);
assert.strictEqual(agent.totalSocketCount, 1);
// Waiting remote server close the socket
setTimeout(common.mustCall(() => {
// Wait for the remote server to close the socket.
req.socket.once('close', common.mustCall(() => {
assert.strictEqual(agent.sockets[name], undefined);
assert.strictEqual(agent.freeSockets[name], undefined);
assert.strictEqual(agent.totalSocketCount, 0);
remoteError();
}), common.platformTimeout(200));
}));
}));
}));
}));
Expand All @@ -115,13 +115,13 @@ function remoteError() {
assert.strictEqual(agent.sockets[name].length, 1);
assert.strictEqual(agent.freeSockets[name], undefined);
assert.strictEqual(agent.totalSocketCount, 1);
// Wait socket 'close' event emit
setTimeout(common.mustCall(() => {
// Wait for the socket's 'close' event.
req.socket.once('close', common.mustCall(() => {
assert.strictEqual(agent.sockets[name], undefined);
assert.strictEqual(agent.freeSockets[name], undefined);
assert.strictEqual(agent.totalSocketCount, 0);
server.close();
}), common.platformTimeout(1));
}));
}));
}

Expand Down
Loading