Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 5447:92b88476873a
sessionmanager, s2smanager: Remove open_session tracing
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 08 Apr 2013 15:53:18 +0100 |
parent | 5377:898454038524 |
child | 5459:3a821511b9ec |
comparison
equal
deleted
inserted
replaced
5445:9054b51e71a4 | 5447:92b88476873a |
---|---|
27 local newproxy = newproxy; | 27 local newproxy = newproxy; |
28 local getmetatable = getmetatable; | 28 local getmetatable = getmetatable; |
29 | 29 |
30 module "sessionmanager" | 30 module "sessionmanager" |
31 | 31 |
32 local open_sessions = 0; | |
33 | |
34 function new_session(conn) | 32 function new_session(conn) |
35 local session = { conn = conn, type = "c2s_unauthed", conntime = gettime() }; | 33 local session = { conn = conn, type = "c2s_unauthed", conntime = gettime() }; |
36 if true then | |
37 session.trace = newproxy(true); | |
38 getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end; | |
39 end | |
40 open_sessions = open_sessions + 1; | |
41 log("debug", "open sessions now: %d", open_sessions); | |
42 | |
43 local filter = initialize_filters(session); | 34 local filter = initialize_filters(session); |
44 local w = conn.write; | 35 local w = conn.write; |
45 session.send = function (t) | 36 session.send = function (t) |
46 if t.name then | 37 if t.name then |
47 t = filter("stanzas/out", t); | 38 t = filter("stanzas/out", t); |
70 }; resting_session.__index = resting_session; | 61 }; resting_session.__index = resting_session; |
71 | 62 |
72 function retire_session(session) | 63 function retire_session(session) |
73 local log = session.log or log; | 64 local log = session.log or log; |
74 for k in pairs(session) do | 65 for k in pairs(session) do |
75 if k ~= "trace" and k ~= "log" and k ~= "id" then | 66 if k ~= "log" and k ~= "id" then |
76 session[k] = nil; | 67 session[k] = nil; |
77 end | 68 end |
78 end | 69 end |
79 | 70 |
80 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); return false; end | 71 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); return false; end |