[Pkg-javascript-commits] [ltx] 86/469: router: unify maxStanzaSize/rateLimit/keepAlive into Router.prototype.setupStream()
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:06 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 0fca81bf9a4cf2ae5dcc280d2588004da2ec9562
Author: Astro <astro at spaceboyz.net>
Date: Mon Sep 6 02:02:36 2010 +0200
router: unify maxStanzaSize/rateLimit/keepAlive into Router.prototype.setupStream()
---
lib/xmpp/router.js | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index 275c480..dbb00af 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -90,9 +90,7 @@ DomainContext.prototype.getOutStream = function(domain) {
this.s2sOut[domain] = outStream;
dbgStream('outgoing', outStream);
- outStream.maxStanzaSize = this.router.maxStanzaSize;
- StreamShaper.attach(outStream, this.router.rateLimit);
- outStream.setKeepAlive(true, this.router.keepAlive);
+ this.router.setupStream(outStream);
this.setupStream(domain, outStream);
outStream.addListener('close', function() {
@@ -234,15 +232,13 @@ exports.Router = Router;
Router.prototype.rateLimit = 1E6; // 100 KB/s, it's S2S after all
Router.prototype.maxStanzaSize = 65536; // 64 KB, by convention
-Router.prototype.keepAlive = 30000; // 30s
+Router.prototype.keepAlive = 30 * 1000; // 30s
Router.prototype.acceptConnection = function(inStream) {
var self = this;
dbgStream('incoming', inStream);
- inStream.maxStanzaSize = this.maxStanzaSize;
- StreamShaper.attach(inStream, this.rateLimit);
- inStream.setKeepAlive(true, this.keepAlive);
+ this.setupStream(inStream);
Server.makeIncomingServer(inStream);
// incoming server wants to verify an outgoing connection of ours
@@ -299,6 +295,12 @@ Router.prototype.acceptConnection = function(inStream) {
});
};
+Router.prototype.setupStream = function(stream) {
+ stream.maxStanzaSize = this.maxStanzaSize;
+ StreamShaper.attach(stream, this.rateLimit);
+ stream.setKeepAlive(true, this.keepAlive);
+};
+
/**
* Create domain context & register a stanza listener callback
*/
--
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