Skip to content

Commit 76afea9

Browse files
committed
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.
1 parent 4612b07 commit 76afea9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/http.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ Agent.prototype._getConnection = function(host, port, cb) {
11161116
// start the process of establishing one.
11171117
Agent.prototype._cycle = function() {
11181118
debug("Agent _cycle sockets=" + this.sockets.length + " queue=" + this.queue.length);
1119+
var self = this;
11191120

11201121
var first = this.queue[0];
11211122
if (!first) return;
@@ -1133,6 +1134,7 @@ Agent.prototype._cycle = function() {
11331134
// We found an available connection!
11341135
this.queue.shift(); // remove first from queue.
11351136
first.assignSocket(socket);
1137+
self._cycle(); // try to dispatch another
11361138
return;
11371139
}
11381140

0 commit comments

Comments
 (0)