[Pkg-javascript-commits] [ltx] 65/469: router: TODO

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:01 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 d9a4c3cfb61e1c4a7e55759b60e8cdb4b691c6c2
Author: Astro <astro at spaceboyz.net>
Date:   Sun Sep 5 15:58:42 2010 +0200

    router: TODO
---
 lib/xmpp/router.js | 82 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 43 insertions(+), 39 deletions(-)

diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index 74edf36..a498878 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -94,57 +94,61 @@ DomainContext.prototype.verifyDialback = function(domain, id, key) {
 /**
  * TODO:
  * * recv stanzas
- * * send on incoming?
+ * * send on incoming? no forwarding.
+ * * jid check (<improper-addressing/>)
  * * karma
  * * nameprep
  * * listening
  * * allow only to hosted domains
  * * timeouts
+ * * parser errors
+ * * keepAlive
  */
 function Router(s2sPort) {
-    var self = this;
     this.ctxs = {};
 
-    net.createServer(function(stream) {
-	dbgStream('incoming', stream);
-	var domain;
-	stream.verifyDialback = function(from, to, id, key) {
-	    domain = from;
-	    return self.verifyDialback(from, to, id, key);
-	};
-	Server.makeIncomingServer(stream);
-	stream.addListener('dialbackVerify', function(from, to, id, key) {
-	    isValid = self.verifyDialback(from, to, id, key);
-	    stream.dialbackVerified(to, from, id, isValid);
-	});
-	stream.addListener('dialbackKey', function(from, to, key) {
-	    var outStream = self.getContext(to).getOut(from);
-	    var sendVerify = function() {
-		outStream.dialbackVerify(to, from, stream.streamId, key);
-
-		var onVerified;
-		onVerified = function(from, to, id, isValid) {
-		    stream.dialbackResult(to, from, isValid);
-		    
-		    outStream.removeListener('dialbackVerified', onVerified);
-		};
-		outStream.addListener('dialbackVerified', onVerified);
-	    };
-	    if (outStream.writable)
-		sendVerify();
-	    else {
-		var connectHook;
-		var connectHook = function() {
-		    sendVerify();
-		    outStream.removeListener('connect', step);
-		};
-		outStream.addListener('connect', connectHook);
-	    }
-	});
-    }).listen(s2sPort || 5269);
+    net.createServer(this.acceptConnection).
+	listen(s2sPort || 5269);
 }
 exports.Router = Router;
 
+Router.prototype.acceptConnection = function(stream) {
+    dbgStream('incoming', stream);
+    var domain;
+    stream.verifyDialback = function(from, to, id, key) {
+	domain = from;
+	return self.verifyDialback(from, to, id, key);
+    };
+    Server.makeIncomingServer(stream);
+    stream.addListener('dialbackVerify', function(from, to, id, key) {
+	isValid = self.verifyDialback(from, to, id, key);
+	stream.dialbackVerified(to, from, id, isValid);
+    });
+    stream.addListener('dialbackKey', function(from, to, key) {
+	var outStream = self.getContext(to).getOut(from);
+	var sendVerify = function() {
+	    outStream.dialbackVerify(to, from, stream.streamId, key);
+
+	    var onVerified;
+	    onVerified = function(from, to, id, isValid) {
+		stream.dialbackResult(to, from, isValid);
+		
+		outStream.removeListener('dialbackVerified', onVerified);
+	    };
+	    outStream.addListener('dialbackVerified', onVerified);
+	};
+	if (outStream.writable)
+	    sendVerify();
+	else {
+	    var connectHook;
+	    var connectHook = function() {
+		sendVerify();
+		outStream.removeListener('connect', step);
+	    };
+	    outStream.addListener('connect', connectHook);
+	}
+};
+
 Router.prototype.send = function(stanza) {
     if (stanza.root)
 	stanza = stanza.root();

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