aboutsummaryrefslogtreecommitdiffstats
path: root/core/sessionmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-12-06 03:41:49 +0000
committerMatthew Wild <mwild1@gmail.com>2008-12-06 03:41:49 +0000
commitdfeabed19fd81dabeb88477c716ecd4c132484c0 (patch)
treea5ccac952fd39818218b3f2e571f70545f52d142 /core/sessionmanager.lua
parentc0334a2ad92f5bff979f309a6276b067487c03a8 (diff)
downloadprosody-dfeabed19fd81dabeb88477c716ecd4c132484c0.tar.gz
prosody-dfeabed19fd81dabeb88477c716ecd4c132484c0.zip
Add hostmanager, and eventmanager
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r--core/sessionmanager.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 36111633..74a17fe5 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -35,6 +35,10 @@ local uuid_generate = require "util.uuid".generate;
local rm_load_roster = require "core.rostermanager".load_roster;
local config_get = require "core.configmanager".get;
+local fire_event = require "core.eventmanager".fire_event;
+
+local gettime = require "socket".gettime;
+
local st = require "util.stanza";
local newproxy = newproxy;
@@ -45,7 +49,7 @@ module "sessionmanager"
local open_sessions = 0;
function new_session(conn)
- local session = { conn = conn, priority = 0, type = "c2s_unauthed" };
+ local session = { conn = conn, priority = 0, type = "c2s_unauthed", conntime = gettime() };
if true then
session.trace = newproxy(true);
getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; print("Session got collected, now "..open_sessions.." sessions are allocated") end;
@@ -109,6 +113,8 @@ function bind_resource(session, resource)
if session.resource then return nil, "cancel", "already-bound", "Cannot bind multiple resources on a single connection"; end
-- We don't support binding multiple resources
+ session.conntimetotal = gettime()-session.conntime;
+
resource = resource or uuid_generate();
--FIXME: Randomly-generated resources must be unique per-user, and never conflict with existing
@@ -175,7 +181,7 @@ function streamopened(session, attr)
local features = st.stanza("stream:features");
- modulemanager.fire_event("stream-features", session, features);
+ fire_event("stream-features", session, features);
send(features);