diff options
author | Kim Alvefur <zash@zash.se> | 2016-03-17 12:47:24 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-03-17 12:47:24 +0100 |
commit | 13099c75ece5abcf46e0af3f691242e086cf1197 (patch) | |
tree | fa5c0c21ffa3d036e15c933567817134ee1d48ea /plugins/mod_c2s.lua | |
parent | 4f0eecb472e8242eaeaf53e0dbc526609851a381 (diff) | |
download | prosody-13099c75ece5abcf46e0af3f691242e086cf1197.tar.gz prosody-13099c75ece5abcf46e0af3f691242e086cf1197.zip |
mod_c2s: Remove use of util.async
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r-- | plugins/mod_c2s.lua | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 42c35689..d950225d 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -15,10 +15,9 @@ local sessionmanager = require "core.sessionmanager"; local st = require "util.stanza"; local sm_new_session, sm_destroy_session = sessionmanager.new_session, sessionmanager.destroy_session; local uuid_generate = require "util.uuid".generate; -local runner = require "util.async".runner; local xpcall, tostring, type = xpcall, tostring, type; -local t_insert, t_remove = table.insert, table.remove; +local traceback = debug.traceback; local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams"; @@ -36,7 +35,6 @@ local hosts = prosody.hosts; local stream_callbacks = { default_ns = "jabber:client" }; local listener = {}; -local runner_callbacks = {}; --- Stream events handlers local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; @@ -123,9 +121,12 @@ function stream_callbacks.error(session, error, data) end end +local function handleerr(err) log("error", "Traceback[c2s]: %s", traceback(tostring(err), 2)); end function stream_callbacks.handlestanza(session, stanza) stanza = session.filter("stanzas/in", stanza); - session.thread:run(stanza); + if stanza then + return xpcall(function () return core_process_stanza(session, stanza) end, handleerr); + end end --- Session methods @@ -191,18 +192,6 @@ module:hook_global("user-deleted", function(event) end end, 200); -function runner_callbacks:ready() - self.data.conn:resume(); -end - -function runner_callbacks:waiting() - self.data.conn:pause(); -end - -function runner_callbacks:error(err) - (self.data.log or log)("error", "Traceback[c2s]: %s", err); -end - --- Port listener function listener.onconnect(conn) measure_connections(1); @@ -240,10 +229,6 @@ function listener.onconnect(conn) session.stream:reset(); end - session.thread = runner(function (stanza) - core_process_stanza(session, stanza); - end, runner_callbacks, session); - local filter = session.filter; function session.data(data) -- Parse the data, which will store stanzas in session.pending_stanzas |