From bf3bb39ea3ebf1faff066579a2647e31aa031ace Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 4 Dec 2008 16:41:32 +0000 Subject: Fix logger ids for c2s and s2sout --- net/xmppclient_listener.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index 8ab3008c..a0d7ea57 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -101,7 +101,7 @@ function xmppclient.listener(conn, data) local mainlog, log = log; do - local conn_name = tostring(conn):match("[a-f0-9]+$"); + local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$"); log = logger.init(conn_name); end local print = function (...) log("info", t_concatall({...}, "\t")); end -- cgit v1.2.3 From 327c81737eb11a340005c7078015c46fdfea6390 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 4 Dec 2008 18:47:26 +0000 Subject: Abstract xmlhandlers a bit more, also add error callbacks --- net/xmppclient_listener.lua | 7 ++++--- net/xmppserver_listener.lua | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'net') diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index a0d7ea57..470c23d2 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -36,7 +36,7 @@ local sm_streamopened = sessionmanager.streamopened; local sm_streamclosed = sessionmanager.streamclosed; local st = stanza; -local stream_callbacks = { streamopened = sm_streamopened, streamclosed = sm_streamclosed }; +local stream_callbacks = { streamopened = sm_streamopened, streamclosed = sm_streamclosed, handlestanza = core_process_stanza }; local sessions = {}; local xmppclient = { default_port = 5222, default_mode = "*a" }; @@ -119,8 +119,9 @@ function xmppclient.listener(conn, data) -- (I'm on a mission, no time to fix now) -- Debug version -- - local function handleerr(err) print("Traceback:", err, debug.traceback()); end - session.stanza_dispatch = function (stanza) return select(2, xpcall(function () return core_process_stanza(session, stanza); end, handleerr)); end + --local function handleerr(err) print("Traceback:", err, debug.traceback()); end + --session.stanza_dispatch = function (stanza) return select(2, xpcall(function () return core_process_stanza(session, stanza); end, handleerr)); end + end if data then session.data(conn, data); diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index 20641998..4b41afbd 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -28,7 +28,7 @@ local s2s_streamopened = require "core.s2smanager".streamopened; local s2s_streamclosed = require "core.s2smanager".streamclosed; local s2s_destroy_session = require "core.s2smanager".destroy_session; local s2s_attempt_connect = require "core.s2smanager".attempt_connection; -local stream_callbacks = { streamopened = s2s_streamopened, streamclosed = s2s_streamclosed }; +local stream_callbacks = { streamopened = s2s_streamopened, streamclosed = s2s_streamclosed, handlestanza = core_process_stanza }; local connlisteners_register = require "net.connlisteners".register; @@ -121,8 +121,8 @@ function xmppserver.listener(conn, data) -- (I'm on a mission, no time to fix now) -- Debug version -- - local function handleerr(err) print("Traceback:", err, debug.traceback()); end - session.stanza_dispatch = function (stanza) return select(2, xpcall(function () return core_process_stanza(session, stanza); end, handleerr)); end +-- local function handleerr(err) print("Traceback:", err, debug.traceback()); end +-- session.stanza_dispatch = function (stanza) return select(2, xpcall(function () return core_process_stanza(session, stanza); end, handleerr)); end end if data then session.data(conn, data); -- cgit v1.2.3