Commit 37e25418 authored by indexzero's avatar indexzero

Emit drain if it doesn't happen on its own in 100ms

parent 6a7fd14b
......@@ -240,6 +240,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
res.once('drain', function () {
response.resume();
});
//
// Force the `drain` event in 100ms if it hasn't
// happened on its own.
//
setTimeout(function () {
res.emit('drain');
}, 100);
}
}
});
......@@ -281,6 +289,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
reverseProxy.once('drain', function () {
req.resume();
});
//
// Force the `drain` event in 100ms if it hasn't
// happened on its own.
//
setTimeout(function () {
reverseProxy.emit('drain');
}, 100);
}
}
});
......@@ -356,6 +372,14 @@ HttpProxy.prototype._forwardRequest = function (req) {
forwardProxy.once('drain', function () {
req.resume();
});
//
// Force the `drain` event in 100ms if it hasn't
// happened on its own.
//
setTimeout(function () {
forwardProxy.emit('drain');
}, 100);
}
});
......@@ -448,6 +472,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
reverseProxy.incoming.socket.once('drain', function () {
proxySocket.resume();
});
//
// Force the `drain` event in 100ms if it hasn't
// happened on its own.
//
setTimeout(function () {
reverseProxy.incoming.socket.emit('drain');
}, 100);
}
}
catch (ex) {
......@@ -471,6 +503,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
proxySocket.once('drain', function () {
reverseProxy.incoming.socket.resume();
});
//
// Force the `drain` event in 100ms if it hasn't
// happened on its own.
//
setTimeout(function () {
proxySocket.emit('drain');
}, 100);
}
}
catch (ex) {
......@@ -635,6 +675,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
socket.once('drain', function () {
reverseProxy.socket.resume();
});
//
// Force the `drain` event in 100ms if it hasn't
// happened on its own.
//
setTimeout(function () {
socket.emit('drain');
}, 100);
}
}
catch (ex) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment