From 28d174b0454f28ff43faaba376e79998e14c6498 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 8 Jul 2013 23:42:54 +0100 Subject: mod_bosh: Only pass stanza to core_process_stanza if it wasn't dropped by filters --- plugins/mod_bosh.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index b88cd969..e9506a83 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -361,7 +361,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 + core_process_stanza(session, stanza); + end end end -- cgit v1.2.3 From b4da24a9cb42c011e1fb3f2dd54d160c00d81ff5 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 8 Jul 2013 23:59:27 +0100 Subject: mod_bosh: pcall() core_process_stanza per stanza, to bring in line with other listeners. This ensures that stanzas following a traceback-causing stanza in a request will still be processed (as would happen on normal c2s). --- plugins/mod_bosh.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index e9506a83..d9c8defd 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -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"; @@ -352,6 +354,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,7 @@ function stream_callbacks.handlestanza(context, stanza) end stanza = session.filter("stanzas/in", stanza); if stanza then - core_process_stanza(session, stanza); + return xpcall(function () return core_process_stanza(session, stanza) end, handleerr); end end end -- cgit v1.2.3 From 98ce25306381896a2502e833f1e218d7c599cc4e Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 8 Jul 2013 23:59:51 +0100 Subject: mod_component: Local imports for some functions, including xpcall --- plugins/mod_component.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index 2fde57ee..a5767c9a 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -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"; -- cgit v1.2.3