[Pkg-javascript-commits] [ltx] 79/469: router: readability

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:04 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 bf106046e0ac233b81b63b2266cf2b1015a02be6
Author: Astro <astro at spaceboyz.net>
Date:   Mon Sep 6 00:00:42 2010 +0200

    router: readability
    
    thanks to payload's review
---
 lib/xmpp/router.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index 5c9a84c..b1ad459 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -82,8 +82,8 @@ DomainContext.prototype.getOutStream = function(domain) {
     } else {
 	console.log("OUTGOING to " + domain);
 	// Setup a new outgoing connection
-	var outStream = this.s2sOut[domain] =
-	    Server.makeOutgoingServer(domain);
+	var outStream = Server.makeOutgoingServer(domain);
+	this.s2sOut[domain] = outStream;
 	dbgStream('outgoing', outStream);
 	this.setupStream(domain, outStream);
 
@@ -154,12 +154,15 @@ DomainContext.prototype.setupStream = function(domain, stream) {
 	    return;
 	}
 
+	// Only accept 'from' attribute JIDs that have the same domain
+	// that we validated the stream for
 	var fromDomain = (new JID.JID(stanza.attrs.from)).domain;
 	if (fromDomain !== domain) {
 	    stream.error('invalid-from');
 	    return;
 	}
 
+	// Only accept 'to' attribute JIDs to this DomainContext
 	var toDomain = (new JID.JID(stanza.attrs.to)).domain;
 	if (toDomain !== self.domain) {
 	    stream.error('improper-addressing');
@@ -229,6 +232,7 @@ Router.prototype.acceptConnection = function(inStream) {
 					from);
 
 	    // TODO: hook inStream close
+	    // these are needed before for removeListener()
 	    var onVerified, onClose;
 	    onVerified = function(from, to, id, isValid) {
 		if (to !== destDomain ||

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