aboutsummaryrefslogtreecommitdiffstats
path: root/core/sessionmanager.lua
blob: 47f47ba9b5203d0bac74afcac1acd7321d7b7f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

local tostring = tostring;

local log = require "util.logger".init("sessionmanager");

module "sessionmanager"

function new_session(conn)
	local session = { conn = conn, notopen = true, priority = 0, type = "c2s_unauthed" };
	local w = conn.write;
	session.send = function (t) w(tostring(t)); end
	return session;
end

function send_to_session(session, data)
	log("debug", "Sending...", tostring(data));
	session.conn.write(tostring(data));
end

return _M;