From 0bba03ccd2d54ae6fc166b7f436e4e918d8d2878 Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Mon, 4 Nov 2013 10:30:54 -0500 Subject: [PATCH] fix processing queued requests --- proxy.js | 5 +++++ server.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/proxy.js b/proxy.js index 25aed6f..1ee66c6 100644 --- a/proxy.js +++ b/proxy.js @@ -135,6 +135,11 @@ Proxy.prototype.next_socket = function(cb) { self.sockets.push(sock); } + // no sockets left to process waiting requests + if (self.sockets.length === 0) { + return; + } + var wait = self.waiting.shift(); debug('processing queued cb'); if (wait) { diff --git a/server.js b/server.js index 33df9c7..c59cf37 100644 --- a/server.js +++ b/server.js @@ -199,6 +199,8 @@ module.exports = function(opt) { }); var server = bouncy(function(req, res, bounce) { + debug('request %s', req.url); + // if we should bounce this request, then don't send to our server if (maybe_bounce(req, res, bounce)) { return;