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

Commit

Permalink
Browse files Browse the repository at this point in the history
http: tiny fix in http.js
Fixes #1885.
  • Loading branch information
xenyou authored and koichik committed Oct 16, 2011
1 parent cdec7e3 commit f90ba61
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit f90ba61

Please sign in to comment.