# HG changeset patch # User Kim Alvefur # Date 1617269726 -7200 # Node ID 53ee391ca6893e48d6237e70298b8db8d1b07e37 # Parent 8bdb9805bb73e7f545c955ed8cde8152ef206a8b 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. diff -r 8bdb9805bb73 -r 53ee391ca689 mod_smacks/mod_smacks.lua --- 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 (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;