Skip to content

Commit 518d33d

Browse files
committed
http: eliminate capture of ClientRequest in Agent
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function.
1 parent eb5b0d3 commit 518d33d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/_http_agent.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
212212
};
213213

214214
function installListeners(agent, s, options) {
215-
216215
function onFree() {
217216
debug('CLIENT socket onFree');
218217
agent.emit('free', s, options);
@@ -239,7 +238,7 @@ function installListeners(agent, s, options) {
239238
s.removeListener('agentRemove', onRemove);
240239
}
241240
s.on('agentRemove', onRemove);
242-
};
241+
}
243242

244243
Agent.prototype.removeSocket = function removeSocket(s, options) {
245244
var name = this.getName(options);

0 commit comments

Comments
 (0)