[Pkg-javascript-commits] [ltx] 94/469: fix stream_shaper

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:07 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 dba0815356737bfe03a96e4f3407f0040f59c879
Author: Astro <astro at spaceboyz.net>
Date:   Mon Sep 6 06:30:37 2010 +0200

    fix stream_shaper
---
 lib/stream_shaper.js | 7 ++++++-
 lib/xmpp/router.js   | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/stream_shaper.js b/lib/stream_shaper.js
index cbb0df4..66ddf2a 100644
--- a/lib/stream_shaper.js
+++ b/lib/stream_shaper.js
@@ -1,3 +1,8 @@
+/**
+ * This is extremely simple and unprecise.
+ *
+ * @param {Number} rateLimit B/ms or KB/s
+ */
 exports.attach = function(stream, rateLimit) {
     var timer;
     stream.rateLimit = rateLimit;  // makes it readjustable after attachment
@@ -6,7 +11,7 @@ exports.attach = function(stream, rateLimit) {
 			       clearTimeout(timer);
 
 			   stream.pause();
-			   var sleep = Math.floor(data.length * 1000 / stream.rateLimit);
+			   var sleep = Math.floor(data.length / stream.rateLimit);
 			   timer = setTimeout(function() {
 			       timer = undefined;
 			       stream.resume();
diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index 0d57714..864c8fd 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -240,7 +240,7 @@ function Router(s2sPort) {
 }
 exports.Router = Router;
 
-Router.prototype.rateLimit = 1E6;  // 100 KB/s, it's S2S after all
+Router.prototype.rateLimit = 100;  // 100 KB/s, it's S2S after all
 Router.prototype.maxStanzaSize = 65536;  // 64 KB, by convention
 Router.prototype.keepAlive = 30 * 1000;  // 30s
 Router.prototype.streamTimeout = 5 * 60 * 1000;  // 5min

-- 
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