diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -13,6 +13,7 @@ dofile "lxmppd.cfg" sessions = {}; +require "util.import" require "core.stanza_dispatch" require "core.xmlhandlers" require "core.rostermanager" @@ -24,6 +25,7 @@ require "core.stanza_router" require "net.connhandlers" require "util.stanza" require "util.jid" + -- Locals for faster access -- local t_insert = table.insert; @@ -31,6 +33,7 @@ local t_concat = table.concat; local t_concatall = function (t, sep) local tt = {}; for _, s in ipairs(t) do t_insert(tt, tostring(s)); end return t_concat(tt, sep); end local m_random = math.random; local format = string.format; +local sm_new_session, sm_destroy_session = sessionmanager.new_session, sessionmanager.destroy_session; --import("core.sessionmanager", "new_session", "destroy_session"); local st = stanza; ------------------------------ @@ -46,7 +49,7 @@ function handler(conn, data, err) local session = sessions[conn]; if not session then - sessions[conn] = sessionmanager.new_session(conn); + sessions[conn] = sm_new_session(conn); session = sessions[conn]; -- Logging functions -- @@ -73,11 +76,8 @@ function handler(conn, data, err) pres:tag("status"):text("Disconnected: "..err); session.stanza_dispatch(pres); end - if session.username then - hosts[session.host].sessions[session.username] = nil; - end session = nil; - print("Disconnected: "..err); + print("Disconnected: "..tostring(err)); collectgarbage("collect"); end end @@ -89,7 +89,7 @@ function handler(conn, data, err) end function disconnect(conn, err) - sessions[conn].disconnect(err); + sm_destroy_session(sessions[conn]); sessions[conn] = nil; end |