[Pkg-javascript-commits] [ltx] 88/469: router: streamTimeout

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 9d68b51691cb4c2425a5604c04bb82cf358b9f1d
Author: Astro <astro at spaceboyz.net>
Date:   Mon Sep 6 02:12:01 2010 +0200

    router: streamTimeout
---
 lib/xmpp/router.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index d733d25..16e6680 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -216,7 +216,6 @@ DomainContext.prototype.receive = function(stanza) {
 
 /**
  * TODO:
- * * connect timeouts, stream idle timeouts
  * * TLS
  */
 function Router(s2sPort) {
@@ -233,6 +232,7 @@ 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 = 30 * 1000;  // 30s
+Router.prototype.streamTimeout = 5 * 60 * 1000;  // 5min
 
 Router.prototype.acceptConnection = function(inStream) {
     var self = this;
@@ -299,6 +299,10 @@ Router.prototype.setupStream = function(stream) {
     stream.maxStanzaSize = this.maxStanzaSize;
     StreamShaper.attach(stream, this.rateLimit);
     stream.setKeepAlive(true, this.keepAlive);
+    stream.setTimeout(this.streamTimeout);
+    stream.addListener('timeout', function() {
+			   stream.error('connection-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