[Pkg-javascript-commits] [ltx] 125/469: stream_shaper: remove timer after close
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository ltx.
commit 8caffaa0e7b5b5e3409a00ec85591216e6496c10
Author: Astro <astro at spaceboyz.net>
Date: Thu Sep 9 18:50:26 2010 +0200
stream_shaper: remove timer after close
---
lib/stream_shaper.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/stream_shaper.js b/lib/stream_shaper.js
index 66ddf2a..1108548 100644
--- a/lib/stream_shaper.js
+++ b/lib/stream_shaper.js
@@ -7,7 +7,7 @@ exports.attach = function(stream, rateLimit) {
var timer;
stream.rateLimit = rateLimit; // makes it readjustable after attachment
stream.addListener('data', function(data) {
- if (timer !== undefined)
+ if (timer)
clearTimeout(timer);
stream.pause();
@@ -17,4 +17,9 @@ exports.attach = function(stream, rateLimit) {
stream.resume();
}, sleep);
});
+ stream.addListener('close', function() {
+ // don't let the last timeout inhibit node shutdown
+ if (timer)
+ clearTimeout(timeout);
+ });
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git
More information about the Pkg-javascript-commits
mailing list