stanza_router: Catch and log an error case which I don't think should happen (but sometimes seems to)

Fri, 10 Jul 2009 02:50:57 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 10 Jul 2009 02:50:57 +0100
changeset 1521
cee81a5ae949
parent 1520
218075f1daf4
child 1522
569d58d21612

stanza_router: Catch and log an error case which I don't think should happen (but sometimes seems to)

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Fri Jul 10 02:38:50 2009 +0100
+++ b/core/stanza_router.lua	Fri Jul 10 02:50:57 2009 +0100
@@ -173,7 +173,10 @@
 		core_post_stanza(origin, stanza);
 	elseif origin.type == "c2s" then
 		-- Remote host
-		if not hosts[from_host].disallow_s2s then
+		if not hosts[from_host] then
+			log("error", "No hosts[from_host] (please report): %s", tostring(stanza));
+		end
+		if (not hosts[from_host]) or (not hosts[from_host].disallow_s2s) then
 			local xmlns = stanza.attr.xmlns;
 			--stanza.attr.xmlns = "jabber:server";
 			stanza.attr.xmlns = nil;

mercurial