diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-07-08 23:59:27 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-07-08 23:59:27 +0100 |
commit | 28d49f20ab126bdbc364966403063a82cd2e939f (patch) | |
tree | 0444ee8e0f23240635c23a39823cc648b16d8257 | |
parent | 6415b0978a33df58758da0b3bf80c1b080cb037d (diff) | |
download | prosody-28d49f20ab126bdbc364966403063a82cd2e939f.tar.gz prosody-28d49f20ab126bdbc364966403063a82cd2e939f.zip |
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).
-rw-r--r-- | plugins/mod_bosh.lua | 5 |
1 files changed, 4 insertions, 1 deletions
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 |