Browse Source

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.
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
76afea90cf
  1. 2
      lib/http.js

2
lib/http.js

@ -1116,6 +1116,7 @@ Agent.prototype._getConnection = function(host, port, cb) {
// start the process of establishing one. // start the process of establishing one.
Agent.prototype._cycle = function() { Agent.prototype._cycle = function() {
debug("Agent _cycle sockets=" + this.sockets.length + " queue=" + this.queue.length); debug("Agent _cycle sockets=" + this.sockets.length + " queue=" + this.queue.length);
var self = this;
var first = this.queue[0]; var first = this.queue[0];
if (!first) return; if (!first) return;
@ -1133,6 +1134,7 @@ Agent.prototype._cycle = function() {
// We found an available connection! // We found an available connection!
this.queue.shift(); // remove first from queue. this.queue.shift(); // remove first from queue.
first.assignSocket(socket); first.assignSocket(socket);
self._cycle(); // try to dispatch another
return; return;
} }

Loading…
Cancel
Save