From: Ryan Dahl Date: Sat, 22 Jan 2011 01:48:14 +0000 (-0800) Subject: Fix test-http-exceptions X-Git-Tag: v0.3.6~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76afea90cf5f5d07f5fdacc5e759a87700d2422c;p=platform%2Fupstream%2Fnodejs.git Fix test-http-exceptions Agent: Each time an http req is sent to a socket, _cycle to try to dispatch another. Problem became apparent in 4612b0 when we wait for connecting sockets. --- diff --git a/lib/http.js b/lib/http.js index 8327342..3232d83 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1116,6 +1116,7 @@ Agent.prototype._getConnection = function(host, port, cb) { // start the process of establishing one. Agent.prototype._cycle = function() { debug("Agent _cycle sockets=" + this.sockets.length + " queue=" + this.queue.length); + var self = this; var first = this.queue[0]; if (!first) return; @@ -1133,6 +1134,7 @@ Agent.prototype._cycle = function() { // We found an available connection! this.queue.shift(); // remove first from queue. first.assignSocket(socket); + self._cycle(); // try to dispatch another return; }