Skip to content

Commit

Permalink
http: simplify Agent initialization
Browse files Browse the repository at this point in the history
PR-URL: #33551
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
  • Loading branch information
himself65 authored and codebytere committed Jun 18, 2020
1 parent a331a00 commit bcdf7e9
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit bcdf7e9

Please sign in to comment.