Comparison

core/s2smanager.lua @ 9935:3dfd5f22e3c6

core.s2smanager: Spread out session tables over multiple lines Improves readability
author Kim Alvefur <zash@zash.se>
date Fri, 29 Mar 2019 22:37:12 +0100
parent 9934:69982753fe4b
child 9936:8695b50368cd
comparison
equal deleted inserted replaced
9934:69982753fe4b 9935:3dfd5f22e3c6
24 24
25 local _ENV = nil; 25 local _ENV = nil;
26 -- luacheck: std none 26 -- luacheck: std none
27 27
28 local function new_incoming(conn) 28 local function new_incoming(conn)
29 local host_session = { conn = conn, type = "s2sin_unauthed", direction = "incoming", hosts = {} }; 29 local host_session = {
30 conn = conn,
31 type = "s2sin_unauthed",
32 direction = "incoming",
33 hosts = {},
34 };
30 host_session.log = logger_init("s2sin"..tostring(host_session):match("[a-f0-9]+$")); 35 host_session.log = logger_init("s2sin"..tostring(host_session):match("[a-f0-9]+$"));
31 incoming_s2s[host_session] = true; 36 incoming_s2s[host_session] = true;
32 return host_session; 37 return host_session;
33 end 38 end
34 39
35 local function new_outgoing(from_host, to_host) 40 local function new_outgoing(from_host, to_host)
36 local host_session = { to_host = to_host, from_host = from_host, host = from_host, 41 local host_session = {
37 notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; 42 to_host = to_host,
43 from_host = from_host,
44 host = from_host,
45 notopen = true,
46 type = "s2sout_unauthed",
47 direction = "outgoing",
48 };
38 hosts[from_host].s2sout[to_host] = host_session; 49 hosts[from_host].s2sout[to_host] = host_session;
39 local conn_name = "s2sout"..tostring(host_session):match("[a-f0-9]*$"); 50 local conn_name = "s2sout"..tostring(host_session):match("[a-f0-9]*$");
40 host_session.log = logger_init(conn_name); 51 host_session.log = logger_init(conn_name);
41 return host_session; 52 return host_session;
42 end 53 end