Skip to content

Commit

Permalink
resume() can throw
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs authored and indexzero committed Sep 8, 2011
1 parent 84be9f2 commit 558a8a4
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions lib/node-http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,11 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
//console.error('backpressure 554');
response.pause();
res.once('drain', function () {
response.resume();
try {
response.resume();
} catch (er) {
console.error("response.resume error: %s", er.message);
}
});
setTimeout(function () {
res.emit('drain');
Expand Down Expand Up @@ -594,7 +598,11 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
//console.error('backpressure 594');
req.pause();
reverseProxy.once('drain', function () {
req.resume();
try {
req.resume();
} catch (er) {
console.error("req.resume error: %s", er.message);
}
});
setTimeout(function () {
reverseProxy.emit('drain');
Expand Down Expand Up @@ -672,7 +680,11 @@ HttpProxy.prototype._forwardRequest = function (req) {
//console.error('backpressure 672');
req.pause();
forwardProxy.once('drain', function () {
req.resume();
try {
req.resume();
} catch (er) {
console.error("req.resume error: %s", er.message);
}
});
setTimeout(function () {
forwardProxy.emit('drain');
Expand Down Expand Up @@ -777,7 +789,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
//console.error('backpressure 777');
proxySocket.pause();
reverseProxy.incoming.socket.once('drain', function () {
proxySocket.resume();
try {
proxySocket.resume();
} catch (er) {
console.error("proxySocket.resume error: %s", er.message);
}
});
setTimeout(function () {
reverseProxy.incoming.socket.emit('drain');
Expand All @@ -804,7 +820,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
//console.error('backpressure 804');
reverseProxy.incoming.socket.pause();
proxySocket.once('drain', function () {
reverseProxy.incoming.socket.resume();
try {
reverseProxy.incoming.socket.resume();
} catch (er) {
console.error("reverseProxy.incoming.socket.resume error: %s", er.message);
}
});
setTimeout(function () {
proxySocket.emit('drain');
Expand Down Expand Up @@ -974,7 +994,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
//console.error('backpressure 974');
reverseProxy.socket.pause();
socket.once('drain', function () {
reverseProxy.socket.resume();
try {
reverseProxy.socket.resume();
} catch (er) {
console.error("reverseProxy.socket.resume error: %s", er.message);
}
});
setTimeout(function () {
socket.emit('drain');
Expand Down

0 comments on commit 558a8a4

Please sign in to comment.