Comparison

util/session.lua @ 7181:8af558965da3

util.session: Fix luacheck warnings
author Kim Alvefur <zash@zash.se>
date Mon, 22 Feb 2016 17:32:11 +0100
parent 6941:33fbc835697d
child 9947:8ebca1240203
comparison
equal deleted inserted replaced
7180:0d7f80263813 7181:8af558965da3
7 }; 7 };
8 return session; 8 return session;
9 end 9 end
10 10
11 local function set_id(session) 11 local function set_id(session)
12 local id = typ .. tostring(session):match("%x+$"):lower(); 12 local id = session.type .. tostring(session):match("%x+$"):lower();
13 session.id = id; 13 session.id = id;
14 return session; 14 return session;
15 end 15 end
16 16
17 local function set_logger(session) 17 local function set_logger(session)
18 local log = logger.init(id); 18 local log = logger.init(session.id);
19 session.log = log; 19 session.log = log;
20 return session; 20 return session;
21 end 21 end
22 22
23 local function set_conn(session, conn) 23 local function set_conn(session, conn)
28 28
29 local function set_send(session) 29 local function set_send(session)
30 local conn = session.conn; 30 local conn = session.conn;
31 if not conn then 31 if not conn then
32 function session.send(data) 32 function session.send(data)
33 log("debug", "Discarding data sent to unconnected session: %s", tostring(data)); 33 session.log("debug", "Discarding data sent to unconnected session: %s", tostring(data));
34 return false; 34 return false;
35 end 35 end
36 return session; 36 return session;
37 end 37 end
38 local filter = initialize_filters(session); 38 local filter = initialize_filters(session);