Software /
code /
prosody-modules
Diff
mod_smacks/mod_smacks.lua @ 4537:53ee391ca689
mod_smacks: Fix traceback due to session being destroyed in send()
Sending something can cause the OS to notice that the connection is dead
and then the connection can be dead at this point. More likely if
opportunistic_writes is enabled.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 01 Apr 2021 11:35:26 +0200 |
parent | 4536:8bdb9805bb73 |
child | 4539:4e7aa32f58d9 |
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua Wed Mar 31 22:06:23 2021 +0200 +++ b/mod_smacks/mod_smacks.lua Thu Apr 01 11:35:26 2021 +0200 @@ -181,6 +181,7 @@ if not session.awaiting_ack and not session.hibernating and not session.destroyed then session.log("debug", "Sending <r> (inside timer, before send) from %s - #queue=%d", reason, #queue); (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) + if session.destroyed then return end -- sending something can trigger destruction session.awaiting_ack = true; -- expected_h could be lower than this expression e.g. more stanzas added to the queue meanwhile) session.last_requested_h = session.last_acknowledged_stanza + #queue;