diff options
author | Rebecca Turner <me@re-becca.org> | 2015-07-24 10:57:25 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-07-24 12:33:43 +0300 |
commit | 230943ceb7c38365bcf4c6e78b9e30e2c949fd9b (patch) | |
tree | e0c3e33f74916b2b55ba3d78147d13409b4b0c1b /node_modules/tunnel-agent | |
parent | 26a46535bed3a8b3e7062ceecca7e6ddb0edbd6e (diff) |
tunnel-agent@0.4.1
Diffstat (limited to 'node_modules/tunnel-agent')
-rw-r--r-- | node_modules/tunnel-agent/index.js | 21 | ||||
-rw-r--r-- | node_modules/tunnel-agent/package.json | 37 |
2 files changed, 39 insertions, 19 deletions
diff --git a/node_modules/tunnel-agent/index.js b/node_modules/tunnel-agent/index.js index 13c04272d..da516ec43 100644 --- a/node_modules/tunnel-agent/index.js +++ b/node_modules/tunnel-agent/index.js @@ -81,23 +81,29 @@ TunnelingAgent.prototype.addRequest = function addRequest(req, options) { if (self.sockets.length >= this.maxSockets) { // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}) + self.requests.push({host: options.host, port: options.port, request: req}) return } // If we are under maxSockets create a new one. - self.createSocket({host: options.host, port: options.port, request: req}, function(socket) { + self.createConnection({host: options.host, port: options.port, request: req}) +} + +TunnelingAgent.prototype.createConnection = function createConnection(pending) { + var self = this + + self.createSocket(pending, function(socket) { socket.on('free', onFree) socket.on('close', onCloseOrRemove) socket.on('agentRemove', onCloseOrRemove) - req.onSocket(socket) + pending.request.onSocket(socket) function onFree() { - self.emit('free', socket, options.host, options.port) + self.emit('free', socket, pending.host, pending.port) } function onCloseOrRemove(err) { - self.removeSocket() + self.removeSocket(socket) socket.removeListener('free', onFree) socket.removeListener('close', onCloseOrRemove) socket.removeListener('agentRemove', onCloseOrRemove) @@ -182,9 +188,7 @@ TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { if (pending) { // If we have pending requests and a socket gets closed a new one // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket) - }) + this.createConnection(pending) } } @@ -197,6 +201,7 @@ function createSecureSocket(options, cb) { , socket: socket } )) + self.sockets[self.sockets.indexOf(socket)] = secureSocket cb(secureSocket) }) } diff --git a/node_modules/tunnel-agent/package.json b/node_modules/tunnel-agent/package.json index 8e246d640..67f840442 100644 --- a/node_modules/tunnel-agent/package.json +++ b/node_modules/tunnel-agent/package.json @@ -6,14 +6,15 @@ ] ], "_from": "tunnel-agent@>=0.4.0 <0.5.0", - "_id": "tunnel-agent@0.4.0", + "_id": "tunnel-agent@0.4.1", "_inCache": true, "_location": "/tunnel-agent", + "_nodeVersion": "0.12.5", "_npmUser": { - "email": "mikeal.rogers@gmail.com", - "name": "mikeal" + "email": "simeonvelichkov@gmail.com", + "name": "simov" }, - "_npmVersion": "1.3.21", + "_npmVersion": "2.11.2", "_phantomChildren": {}, "_requested": { "name": "tunnel-agent", @@ -26,8 +27,8 @@ "_requiredBy": [ "/request" ], - "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.0.tgz", - "_shasum": "b1184e312ffbcf70b3b4c78e8c219de7ebb1c550", + "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.1.tgz", + "_shasum": "bbeecff4d679ce753db9462761a88dfcec3c5ab3", "_shrinkwrap": null, "_spec": "tunnel-agent@~0.4.0", "_where": "/Users/rebecca/code/npm/node_modules/request", @@ -44,24 +45,38 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "b1184e312ffbcf70b3b4c78e8c219de7ebb1c550", - "tarball": "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.0.tgz" + "shasum": "bbeecff4d679ce753db9462761a88dfcec3c5ab3", + "tarball": "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.1.tgz" }, "engines": { "node": "*" }, - "homepage": "https://github.com/mikeal/tunnel-agent", + "gitHead": "912a7a6d00e10ec76baf9c9369de280fa5badef3", + "homepage": "https://github.com/mikeal/tunnel-agent#readme", "main": "index.js", "maintainers": [ { "name": "mikeal", "email": "mikeal.rogers@gmail.com" + }, + { + "name": "nylen", + "email": "jnylen@gmail.com" + }, + { + "name": "fredkschott", + "email": "fkschott@gmail.com" + }, + { + "name": "simov", + "email": "simeonvelichkov@gmail.com" } ], "name": "tunnel-agent", "optionalDependencies": {}, "repository": { - "url": "https://github.com/mikeal/tunnel-agent" + "url": "git+https://github.com/mikeal/tunnel-agent.git" }, - "version": "0.4.0" + "scripts": {}, + "version": "0.4.1" } |