Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
ronag committed Jan 16, 2021
commit a077054985e661a1e552f9322ea0880522484809
8 changes: 3 additions & 5 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ const {
const { once } = require('internal/util');
const { validateNumber, validateOneOf } = require('internal/validators');

function nop() {}

const kOnKeylog = Symbol('onkeylog');
const kRequestOptions = Symbol('requestOptions');
const kRequestAsyncResource = Symbol('requestAsyncResource');
Expand Down Expand Up @@ -133,7 +131,7 @@ function Agent(options) {
// and could cause unhandled exception.

if (!socket.writable) {
socket.on('error', nop).destroy();
socket.destroy();
return;
}

Expand Down Expand Up @@ -161,7 +159,7 @@ function Agent(options) {
// the freeSockets pool, but only if we're allowed to do so.
const req = socket._httpMessage;
if (!req || !req.shouldKeepAlive || !this.keepAlive) {
socket.on('error', nop).destroy();
socket.destroy();
return;
}

Expand All @@ -175,7 +173,7 @@ function Agent(options) {
count > this.maxSockets ||
freeLen >= this.maxFreeSockets ||
!this.keepSocketAlive(socket)) {
socket.on('error', nop).destroy();
socket.destroy();
return;
}

Expand Down