aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-12-05 19:24:01 +0000
committerMatthew Wild <mwild1@gmail.com>2008-12-05 19:24:01 +0000
commit0d2b952b610069996f733700117a2e62d5b73696 (patch)
tree85b082e3702efeb0e019107679816862619730cd /core
parent32371bbb23449dc86e5d66c54ae862747bc7f398 (diff)
downloadprosody-0d2b952b610069996f733700117a2e62d5b73696.tar.gz
prosody-0d2b952b610069996f733700117a2e62d5b73696.zip
Add TLS socket to readlist before handshake starts, fixes major slow-down on TLS connections
Diffstat (limited to 'core')
-rw-r--r--core/presencemanager.lua9
-rw-r--r--core/sessionmanager.lua6
2 files changed, 14 insertions, 1 deletions
diff --git a/core/presencemanager.lua b/core/presencemanager.lua
index 6e27752b..dbcb83d6 100644
--- a/core/presencemanager.lua
+++ b/core/presencemanager.lua
@@ -21,6 +21,7 @@
local log = require "util.logger".init("presencemanager")
+local tostring = tostring;
local require = require;
local pairs, ipairs = pairs, ipairs;
local t_concat = table.concat;
@@ -121,6 +122,14 @@ function handle_normal_presence(origin, stanza, core_route_stanza)
else
log("error", "presence recieved from client with no roster");
end
+
+ if origin.conntimetotal then
+ local session = origin;
+ origin.log("BLAH", "***********\n\n\n\n\n\n****************");
+ origin.send(st.stanza("message", { from = session.host, to=session.full_jid, type = "normal" }):body("Your login took "..tostring(session.conntimetotal).." seconds"));
+ origin.conntimetotal = nil;
+ end
+
end
function send_presence_of_available_resources(user, host, jid, recipient_session, core_route_stanza)
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 36111633..bc48d228 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -35,6 +35,8 @@ local uuid_generate = require "util.uuid".generate;
local rm_load_roster = require "core.rostermanager".load_roster;
local config_get = require "core.configmanager".get;
+local gettime = require "socket".gettime;
+
local st = require "util.stanza";
local newproxy = newproxy;
@@ -45,7 +47,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 +111,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