aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-05-18 17:45:20 +0200
committerKim Alvefur <zash@zash.se>2019-05-18 17:45:20 +0200
commitc85ae3be7853cde7e08c2afad290770994f4c851 (patch)
treee74b5f45aa3f562ddad3c83f2ae8cd4d4fc22bdc /plugins/mod_c2s.lua
parent9838f3732d53e1e3d34cd57a25a030f61005cb53 (diff)
downloadprosody-c85ae3be7853cde7e08c2afad290770994f4c851.tar.gz
prosody-c85ae3be7853cde7e08c2afad290770994f4c851.zip
mod_c2s: Associate connection with session last (fixes #1313)
This way, any fatal error in the callback will not leave a half-established session.
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua3
1 files changed, 2 insertions, 1 deletions
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)