Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 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 |
parent | 9908:7d12af856238 |
child | 10043:ce8e18f20693 |
comparison
equal
deleted
inserted
replaced
9936:8695b50368cd | 9937:6245ee9494c6 |
---|---|
19 local rm_load_roster = require "core.rostermanager".load_roster; | 19 local rm_load_roster = require "core.rostermanager".load_roster; |
20 local config_get = require "core.configmanager".get; | 20 local config_get = require "core.configmanager".get; |
21 local resourceprep = require "util.encodings".stringprep.resourceprep; | 21 local resourceprep = require "util.encodings".stringprep.resourceprep; |
22 local nodeprep = require "util.encodings".stringprep.nodeprep; | 22 local nodeprep = require "util.encodings".stringprep.nodeprep; |
23 local generate_identifier = require "util.id".short; | 23 local generate_identifier = require "util.id".short; |
24 local sessionlib = require "util.session"; | |
24 | 25 |
25 local initialize_filters = require "util.filters".initialize; | 26 local initialize_filters = require "util.filters".initialize; |
26 local gettime = require "socket".gettime; | 27 local gettime = require "socket".gettime; |
27 | 28 |
28 local _ENV = nil; | 29 local _ENV = nil; |
29 -- luacheck: std none | 30 -- luacheck: std none |
30 | 31 |
31 local function new_session(conn) | 32 local function new_session(conn) |
32 local session = { conn = conn, type = "c2s_unauthed", conntime = gettime() }; | 33 local session = sessionlib.new("c2s"); |
34 sessionlib.set_id(session); | |
35 sessionlib.set_logger(session); | |
36 sessionlib.set_conn(session, conn); | |
37 | |
38 session.conntime = gettime(); | |
33 local filter = initialize_filters(session); | 39 local filter = initialize_filters(session); |
34 local w = conn.write; | 40 local w = conn.write; |
35 | 41 |
36 function session.rawsend(t) | 42 function session.rawsend(t) |
37 t = filter("bytes/out", tostring(t)); | 43 t = filter("bytes/out", tostring(t)); |