aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/server.lua4
-rw-r--r--net/xmppclient_listener.lua19
-rw-r--r--net/xmppserver_listener.lua30
3 files changed, 17 insertions, 36 deletions
diff --git a/net/server.lua b/net/server.lua
index 55afcf3f..5c129753 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -798,10 +798,6 @@ end
loop = function( ) -- this is the main loop of the program
--signal_set( "hub", "run" )
repeat
- --[[print(readlen, writelen)
- for _, s in ipairs(readlist) do print("R:", tostring(s)) end
- for _, s in ipairs(writelist) do print("W:", tostring(s)) end
- out_put("select()"..os.time())]]
local read, write, err = socket_select( readlist, writelist, 1 ) -- 1 sec timeout, nice for timers
for i, socket in ipairs( write ) do -- send data waiting in writequeues
local handler = socketlist[ socket ]
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua
index 22af2de4..c2326a55 100644
--- a/net/xmppclient_listener.lua
+++ b/net/xmppclient_listener.lua
@@ -47,7 +47,7 @@ function stream_callbacks.error(session, error, data)
end
end
-local function handleerr(err) print("Traceback:", err, debug.traceback()); end
+local function handleerr(err) log("error", "Traceback[c2s]:", err, debug.traceback()); end
function stream_callbacks.handlestanza(a, b)
xpcall(function () core_process_stanza(a, b) end, handleerr);
end
@@ -116,25 +116,16 @@ function xmppclient.listener(conn, data)
-- Logging functions --
- local mainlog, log = log;
- do
- 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
- session.log = log;
-
- print("Client connected");
+ local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$");
+ session.log = logger.init(conn_name);
+
+ session.log("info", "Client connected");
session.reset_stream = session_reset_stream;
session.close = session_close;
session_reset_stream(session); -- Initialise, ready for use
- -- TODO: Below function should be session,stanza - and xmlhandlers should use :method() notation to call,
- -- this will avoid the useless indirection we have atm
- -- (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
diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua
index bdd3948d..e4816b1e 100644
--- a/net/xmppserver_listener.lua
+++ b/net/xmppserver_listener.lua
@@ -39,6 +39,11 @@ function stream_callbacks.error(session, error, data)
end
end
+local function handleerr(err) log("error", "Traceback[s2s]:", err, debug.traceback()); end
+function stream_callbacks.handlestanza(a, b)
+ xpcall(function () core_process_stanza(a, b) end, handleerr);
+end
+
local connlisteners_register = require "net.connlisteners".register;
local t_insert = table.insert;
@@ -113,25 +118,17 @@ function xmppserver.listener(conn, data)
-- Logging functions --
- local mainlog, log = log;
- do
- local conn_name = "s2sin"..tostring(conn):match("[a-f0-9]+$");
- log = logger.init(conn_name);
- end
- local print = function (...) log("info", t_concatall({...}, "\t")); end
- session.log = log;
-
- print("Incoming s2s connection");
+
+ local conn_name = "s2sin"..tostring(conn):match("[a-f0-9]+$");
+ session.log = logger.init(conn_name);
+
+ session.log("info", "Incoming s2s connection");
session.reset_stream = session_reset_stream;
session.close = session_close;
session_reset_stream(session); -- Initialise, ready for use
- -- FIXME: Below function should be session,stanza - and xmlhandlers should use :method() notation to call,
- -- this will avoid the useless indirection we have atm
- -- (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
@@ -164,11 +161,8 @@ function xmppserver.register_outgoing(conn, session)
session.reset_stream = session_reset_stream;
session_reset_stream(session); -- Initialise, ready for use
- -- FIXME: Below function should be session,stanza - and xmlhandlers should use :method() notation to call,
- -- this will avoid the useless indirection we have atm
- -- (I'm on a mission, no time to fix now)
- 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
connlisteners_register("xmppserver", xmppserver);