|
@ -91,7 +91,7 @@ Agent.defaultMaxSockets = Infinity; |
|
|
Agent.prototype.createConnection = net.createConnection; |
|
|
Agent.prototype.createConnection = net.createConnection; |
|
|
|
|
|
|
|
|
// Get the key for a given set of request options
|
|
|
// Get the key for a given set of request options
|
|
|
Agent.prototype.getName = function(options) { |
|
|
Agent.prototype.getName = function getName(options) { |
|
|
var name = options.host || 'localhost'; |
|
|
var name = options.host || 'localhost'; |
|
|
|
|
|
|
|
|
name += ':'; |
|
|
name += ':'; |
|
@ -110,7 +110,7 @@ Agent.prototype.getName = function(options) { |
|
|
return name; |
|
|
return name; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
Agent.prototype.addRequest = function(req, options) { |
|
|
Agent.prototype.addRequest = function addRequest(req, options) { |
|
|
// Legacy API: addRequest(req, host, port, localAddress)
|
|
|
// Legacy API: addRequest(req, host, port, localAddress)
|
|
|
if (typeof options === 'string') { |
|
|
if (typeof options === 'string') { |
|
|
options = { |
|
|
options = { |
|
@ -173,7 +173,7 @@ Agent.prototype.addRequest = function(req, options) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
Agent.prototype.createSocket = function(req, options, cb) { |
|
|
Agent.prototype.createSocket = function createSocket(req, options, cb) { |
|
|
var self = this; |
|
|
var self = this; |
|
|
options = util._extend({}, options); |
|
|
options = util._extend({}, options); |
|
|
options = util._extend(options, self.options); |
|
|
options = util._extend(options, self.options); |
|
@ -236,7 +236,7 @@ Agent.prototype.createSocket = function(req, options, cb) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
Agent.prototype.removeSocket = function(s, options) { |
|
|
Agent.prototype.removeSocket = function removeSocket(s, options) { |
|
|
var name = this.getName(options); |
|
|
var name = this.getName(options); |
|
|
debug('removeSocket', name, 'writable:', s.writable); |
|
|
debug('removeSocket', name, 'writable:', s.writable); |
|
|
var sets = [this.sockets]; |
|
|
var sets = [this.sockets]; |
|
@ -275,7 +275,7 @@ Agent.prototype.removeSocket = function(s, options) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
Agent.prototype.destroy = function() { |
|
|
Agent.prototype.destroy = function destroy() { |
|
|
var sets = [this.freeSockets, this.sockets]; |
|
|
var sets = [this.freeSockets, this.sockets]; |
|
|
for (var s = 0; s < sets.length; s++) { |
|
|
for (var s = 0; s < sets.length; s++) { |
|
|
var set = sets[s]; |
|
|
var set = sets[s]; |
|
|