Changeset

5729:8de1f9290588

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 09 Jul 2013 00:04:30 +0100
parents 5725:c4200292758c (current diff) 5728:2ecf400b194a (diff)
children 5731:902927f1c96f
files plugins/mod_bosh.lua
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_bosh.lua	Mon Jul 08 21:41:31 2013 +0100
+++ b/plugins/mod_bosh.lua	Tue Jul 09 00:04:30 2013 +0100
@@ -20,6 +20,8 @@
 local log = logger.init("mod_bosh");
 local initialize_filters = require "util.filters".initialize;
 local math_min = math.min;
+local xpcall, tostring, type = xpcall, tostring, type;
+local traceback = debug.traceback;
 
 local xmlns_streams = "http://etherx.jabber.org/streams";
 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
@@ -353,6 +355,7 @@
 	end
 end
 
+local function handleerr(err) log("error", "Traceback[bosh]: %s", traceback(tostring(err), 2)); end
 function stream_callbacks.handlestanza(context, stanza)
 	if context.ignore then return; end
 	log("debug", "BOSH stanza received: %s\n", stanza:top_tag());
@@ -362,7 +365,9 @@
 			stanza.attr.xmlns = nil;
 		end
 		stanza = session.filter("stanzas/in", stanza);
-		core_process_stanza(session, stanza);
+		if stanza then
+			return xpcall(function () return core_process_stanza(session, stanza) end, handleerr);
+		end
 	end
 end
 
--- a/plugins/mod_component.lua	Mon Jul 08 21:41:31 2013 +0100
+++ b/plugins/mod_component.lua	Tue Jul 09 00:04:30 2013 +0100
@@ -9,6 +9,7 @@
 module:set_global();
 
 local t_concat = table.concat;
+local xpcall, tostring, type = xpcall, tostring, type;
 local traceback = debug.traceback;
 
 local logger = require "util.logger";