Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

tiny fix in http.js #1885

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/http.js
Expand Up @@ -956,8 +956,11 @@ Agent.prototype.createSocket = function(name, host, port) {
return s;
};
Agent.prototype.removeSocket = function(s, name, host, port) {
if (this.sockets[name] && this.sockets[name].indexOf(s) !== -1) {
this.sockets[name].shift(this.sockets[name].indexOf(s));
if (this.sockets[name]) {
var index = this.sockets[name].indexOf(s);
if (index !== -1) {
this.sockets[name].splice(index, 1);
}
} else if (this.sockets[name] && this.sockets[name].length === 0) {
// don't leak
delete this.sockets[name];
Expand Down