Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 1684:645e18990211
core.sessionmanager, xmppclient_listener: Move responsibility for setting session.log to the former from the latter, much more sensible
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 16 Aug 2009 21:34:53 +0100 |
parent | 1523:841d61be198f |
child | 1872:1905eca82ddf |
comparison
equal
deleted
inserted
replaced
1683:a73b0557d87a | 1684:645e18990211 |
---|---|
17 local hosts = hosts; | 17 local hosts = hosts; |
18 local full_sessions = full_sessions; | 18 local full_sessions = full_sessions; |
19 local bare_sessions = bare_sessions; | 19 local bare_sessions = bare_sessions; |
20 | 20 |
21 local modulemanager = require "core.modulemanager"; | 21 local modulemanager = require "core.modulemanager"; |
22 local log = require "util.logger".init("sessionmanager"); | 22 local logger = require "util.logger"; |
23 local log = logger.init("sessionmanager"); | |
23 local error = error; | 24 local error = error; |
24 local uuid_generate = require "util.uuid".generate; | 25 local uuid_generate = require "util.uuid".generate; |
25 local rm_load_roster = require "core.rostermanager".load_roster; | 26 local rm_load_roster = require "core.rostermanager".load_roster; |
26 local config_get = require "core.configmanager".get; | 27 local config_get = require "core.configmanager".get; |
27 local nameprep = require "util.encodings".stringprep.nameprep; | 28 local nameprep = require "util.encodings".stringprep.nameprep; |
48 open_sessions = open_sessions + 1; | 49 open_sessions = open_sessions + 1; |
49 log("debug", "open sessions now: ".. open_sessions); | 50 log("debug", "open sessions now: ".. open_sessions); |
50 local w = conn.write; | 51 local w = conn.write; |
51 session.send = function (t) w(tostring(t)); end | 52 session.send = function (t) w(tostring(t)); end |
52 session.ip = conn.ip(); | 53 session.ip = conn.ip(); |
54 local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$"); | |
55 session.log = logger.init(conn_name); | |
56 | |
53 return session; | 57 return session; |
54 end | 58 end |
55 | 59 |
56 function destroy_session(session, err) | 60 function destroy_session(session, err) |
57 (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)"); | 61 (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)"); |