Skip to content

Commit

Permalink
http: fix http agent keep alive
Browse files Browse the repository at this point in the history
  • Loading branch information
theanarkh committed Jun 11, 2022
1 parent 917fcb2 commit 565464c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,11 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
installListeners(this, s, options);
cb(null, s);
});

// when keepAlive is true, pass the related options to createConnection
if (this.keepAlive) {
options.keepAlive = this.keepAlive;
options.keepAliveInitialDelay = this.keepAliveMsecs;
}
const newSocket = this.createConnection(options, oncreate);
if (newSocket)
oncreate(null, newSocket);
Expand Down

0 comments on commit 565464c

Please sign in to comment.