Skip to content

Commit

Permalink
moved drain callback to the socket so it doesn't get recreated on eac…
Browse files Browse the repository at this point in the history
…h request.
  • Loading branch information
Hunter Loftis committed Mar 22, 2012
1 parent 3165d35 commit 1b8e2c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/middleware/timeout.js
Expand Up @@ -39,11 +39,11 @@ module.exports = function timeout(options) {
}
}

if (!req.clearTimeout) {
req.clearTimeout = function() {
if (!req.socket.clearTimeout) {
req.socket.clearTimeout = function() {
req.socket.setTimeout(0);
};
req.socket.once('drain', req.clearTimeout); // Clear whenever we send anything
req.socket.once('drain', req.socket.clearTimeout); // Clear whenever we send anything
}

return next();
Expand Down

0 comments on commit 1b8e2c9

Please sign in to comment.