Changeset

10013:62d8689beafb 0.11

mod_c2s: Associate connection with session last (fixes #1313) This way, any fatal error in the callback will not leave a half-established session.
author Kim Alvefur <zash@zash.se>
date Sat, 18 May 2019 17:45:20 +0200
parents 10012:acf4a7bfb6aa
children 10014:5d2f7144fa12
files plugins/mod_c2s.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Mon May 13 14:39:38 2019 +0200
+++ b/plugins/mod_c2s.lua	Sat May 18 17:45:20 2019 +0200
@@ -239,7 +239,6 @@
 --- Port listener
 function listener.onconnect(conn)
 	local session = sm_new_session(conn);
-	sessions[conn] = session;
 
 	session.log("info", "Client connected");
 
@@ -300,6 +299,8 @@
 	end
 
 	session.dispatch_stanza = stream_callbacks.handlestanza;
+
+	sessions[conn] = session;
 end
 
 function listener.onincoming(conn, data)