better handling of requests that die

This commit is contained in:
Roman Shtylman
2014-10-25 16:59:16 -07:00
parent a5edd0f8f4
commit 4a09dc114a
2 changed files with 19 additions and 0 deletions

View File

@@ -139,8 +139,14 @@ Proxy.prototype.next_socket = function(cb) {
return self.waiting.push(cb);
}
var done_called = false;
// put the socket back
function done() {
if (done_called) {
throw new Error('done called multiple times');
}
done_called = true;
if (!sock.destroyed) {
debug('retuning socket');
self.sockets.push(sock);