Permalink
Browse files

moved drain callback to the socket so it doesn't get recreated on eac…

…h request.
  • Loading branch information...
1 parent 3165d35 commit 1b8e2c9cdf98e51845d818710b6a973d06fe0529 Hunter Loftis committed Mar 22, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/middleware/timeout.js
@@ -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();

0 comments on commit 1b8e2c9

Please sign in to comment.