Merge 0.9->trunk
authorMatthew Wild <mwild1@gmail.com>
Mon, 8 Jul 2013 23:04:30 +0000 (00:04 +0100)
committerMatthew Wild <mwild1@gmail.com>
Mon, 8 Jul 2013 23:04:30 +0000 (00:04 +0100)
plugins/mod_bosh.lua
plugins/mod_component.lua

index 9a612ae0882652d45d9c885776a7fd0d81c3bac1..d8717d18a9075982bd21ebd21d56af3f40f49571 100644 (file)
@@ -20,6 +20,8 @@ local logger = require "util.logger";
 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 @@ function stream_callbacks.streamopened(context, attr)
        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 @@ function stream_callbacks.handlestanza(context, stanza)
                        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
 
index 2fde57ee1610fac7b521b65635178896529ecccb..a5767c9a33039ed0653266d2714630dcbbd93041 100644 (file)
@@ -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";