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
change self to agent
  • Loading branch information
evantorrie committed Dec 9, 2016
commit eb5b0d35e20dcb903c4ac59285a2f235bc44918c
7 changes: 3 additions & 4 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,10 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
};

function installListeners(agent, s, options) {
var self = agent;

function onFree() {
debug('CLIENT socket onFree');
self.emit('free', s, options);
agent.emit('free', s, options);
}
s.on('free', onFree);

Expand All @@ -225,7 +224,7 @@ function installListeners(agent, s, options) {
// This is the only place where sockets get removed from the Agent.
// If you want to remove a socket from the pool, just close it.
// All socket errors end in a close event anyway.
self.removeSocket(s, options);
agent.removeSocket(s, options);
}
s.on('close', onClose);

Expand All @@ -234,7 +233,7 @@ function installListeners(agent, s, options) {
// (defined by WebSockets) where we need to remove a socket from the
// pool because it'll be locked up indefinitely
debug('CLIENT socket onRemove');
self.removeSocket(s, options);
agent.removeSocket(s, options);
s.removeListener('close', onClose);
s.removeListener('free', onFree);
s.removeListener('agentRemove', onRemove);
Expand Down