aboutsummaryrefslogtreecommitdiffstats
path: root/main.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-10-04 15:25:54 +0100
committerMatthew Wild <mwild1@gmail.com>2008-10-04 15:25:54 +0100
commit88af2ea6e9728680b5f0216143246d8486952b91 (patch)
tree713c6073186469d4a775336f9a20c604a2c88879 /main.lua
parent762a906e3654c3179c025a2886e9b7f4821f8666 (diff)
downloadprosody-88af2ea6e9728680b5f0216143246d8486952b91.tar.gz
prosody-88af2ea6e9728680b5f0216143246d8486952b91.zip
Session destruction fixes, some debugging code while we fix the rest. Also change logger to be more useful.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/main.lua b/main.lua
index 027a472c..821b3273 100644
--- a/main.lua
+++ b/main.lua
@@ -33,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;
------------------------------
@@ -48,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 --
@@ -75,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
@@ -91,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