parent
cdec7e3ae5
commit
f90ba61478
@ -956,8 +956,11 @@ Agent.prototype.createSocket = function(name, host, port) {
|
|||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
Agent.prototype.removeSocket = function(s, name, host, port) {
|
Agent.prototype.removeSocket = function(s, name, host, port) {
|
||||||
if (this.sockets[name] && this.sockets[name].indexOf(s) !== -1) {
|
if (this.sockets[name]) {
|
||||||
this.sockets[name].shift(this.sockets[name].indexOf(s));
|
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) {
|
} else if (this.sockets[name] && this.sockets[name].length === 0) {
|
||||||
// don't leak
|
// don't leak
|
||||||
delete this.sockets[name];
|
delete this.sockets[name];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user