Skip to content
Closed
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
http: simplify Agent initialization
  • Loading branch information
himself65 committed May 28, 2020
commit 58d652e03f049b3f5d5b2a5529c4c185bf5827cf
5 changes: 2 additions & 3 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ function Agent(options) {
return;
}

let freeSockets = this.freeSockets[name];
const freeLen = freeSockets ? freeSockets.length : 0;
const freeSockets = this.freeSockets[name] || [];
const freeLen = freeSockets.length;
let count = freeLen;
if (this.sockets[name])
count += this.sockets[name].length;
Expand All @@ -138,7 +138,6 @@ function Agent(options) {
return;
}

freeSockets = freeSockets || [];
this.freeSockets[name] = freeSockets;
socket[async_id_symbol] = -1;
socket._httpMessage = null;
Expand Down