core/sessionmanager.lua

changeset 30
bcf539295f2d
child 38
3fdfd6e0cb4e
equal deleted inserted replaced
29:b847875801e5 30:bcf539295f2d
1
2 local tostring = tostring;
3
4 local log = require "util.logger".init("sessionmanager");
5
6 module "sessionmanager"
7
8 function new_session(conn)
9 local session = { conn = conn, notopen = true, priority = 0, type = "c2s_unauthed" };
10 local w = conn.write;
11 session.send = function (t) w(tostring(t)); end
12 return session;
13 end
14
15 function send_to_session(session, data)
16 log("debug", "Sending...", tostring(data));
17 session.conn.write(tostring(data));
18 end
19
20 return _M;

mercurial