aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-18 13:43:57 +0100
committerKim Alvefur <zash@zash.se>2021-12-18 13:43:57 +0100
commit6c98ee025ee01c1cf25eb9f45ae032a1a03cdda0 (patch)
tree0805c4b9dd890a3170813e450dfcaaef9166dc9d /plugins/mod_c2s.lua
parent3fe05657e35bcf358356dbdaf186af430d190f90 (diff)
downloadprosody-6c98ee025ee01c1cf25eb9f45ae032a1a03cdda0.tar.gz
prosody-6c98ee025ee01c1cf25eb9f45ae032a1a03cdda0.zip
mod_c2s: Fire pre-closing event regardless of connected state
With mod_smacks, a session can outlive the connection, so whether the event is fired should not hinge on whether the session is connected or not. Helps mod_smacks remove some state.
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 204ac16d..c9aae3bc 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -186,13 +186,13 @@ end
--- Session methods
local function session_close(session, reason)
local log = session.log or log;
+ local close_event_payload = { session = session, reason = reason };
+ module:context(session.host):fire_event("pre-session-close", close_event_payload);
+ reason = close_event_payload.reason;
if session.conn then
if session.notopen then
session:open_stream();
end
- local close_event_payload = { session = session, reason = reason };
- module:context(session.host):fire_event("pre-session-close", close_event_payload);
- reason = close_event_payload.reason;
if reason then -- nil == no err, initiated by us, false == initiated by client
local stream_error = st.stanza("stream:error");
if type(reason) == "string" then -- assume stream error