Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added check to ensure clearTimeout is only created once, and the sing…

…le event listener is also only created once.
  • Loading branch information...
commit 3165d358c2953dc41a0ae7401e5fbb024cecfe74 1 parent c07c0d3
Hunter Loftis authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/middleware/timeout.js
View
11 lib/middleware/timeout.js
@@ -39,11 +39,12 @@ module.exports = function timeout(options) {
}
}
- req.clearTimeout = function() {
- req.socket.setTimeout(0);
- };
-
- req.socket.once('drain', req.clearTimeout); // Clear whenever we send anything
+ if (!req.clearTimeout) {
+ req.clearTimeout = function() {
+ req.socket.setTimeout(0);
+ };
+ req.socket.once('drain', req.clearTimeout); // Clear whenever we send anything
+ }
return next();
};
Please sign in to comment.
Something went wrong with that request. Please try again.