Changeset

9937:6245ee9494c6

core.sessionmanager: Use util.session to create sessions
author Kim Alvefur <zash@zash.se>
date Fri, 29 Mar 2019 23:05:08 +0100
parents 9936:8695b50368cd
children 9938:4e8ba156738b
files core/sessionmanager.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/sessionmanager.lua	Fri Mar 29 22:40:53 2019 +0100
+++ b/core/sessionmanager.lua	Fri Mar 29 23:05:08 2019 +0100
@@ -21,6 +21,7 @@
 local resourceprep = require "util.encodings".stringprep.resourceprep;
 local nodeprep = require "util.encodings".stringprep.nodeprep;
 local generate_identifier = require "util.id".short;
+local sessionlib = require "util.session";
 
 local initialize_filters = require "util.filters".initialize;
 local gettime = require "socket".gettime;
@@ -29,7 +30,12 @@
 -- luacheck: std none
 
 local function new_session(conn)
-	local session = { conn = conn, type = "c2s_unauthed", conntime = gettime() };
+	local session = sessionlib.new("c2s");
+	sessionlib.set_id(session);
+	sessionlib.set_logger(session);
+	sessionlib.set_conn(session, conn);
+
+	session.conntime = gettime();
 	local filter = initialize_filters(session);
 	local w = conn.write;