From 4512a6266dabd2ecd24579421f3d1253961ec233 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 18 May 2019 17:45:20 +0200 Subject: mod_c2s: Associate connection with session last (fixes #1313) This way, any fatal error in the callback will not leave a half-established session. --- plugins/mod_c2s.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 8e31a968..15d3a9be 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -239,7 +239,6 @@ end --- Port listener function listener.onconnect(conn) local session = sm_new_session(conn); - sessions[conn] = session; session.log("info", "Client connected"); @@ -300,6 +299,8 @@ function listener.onconnect(conn) end session.dispatch_stanza = stream_callbacks.handlestanza; + + sessions[conn] = session; end function listener.onincoming(conn, data) -- cgit v1.2.3