# HG changeset patch # User tmolitor # Date 1565485136 -7200 # Node ID 58047d6f2b89b4bcda71e1eea27bf92d0895a36f # Parent 413ea67597d25b829303cdfc65181d921c91cd05 mod_smacks: fix bug #1405 (prevent timer from running for already destroyed sessions) diff -r 413ea67597d2 -r 58047d6f2b89 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Sat Aug 10 14:19:48 2019 +0200 +++ b/mod_smacks/mod_smacks.lua Sun Aug 11 02:58:56 2019 +0200 @@ -5,7 +5,7 @@ -- Copyright (C) 2012-2015 Kim Alvefur -- Copyright (C) 2012 Thijs Alkemade -- Copyright (C) 2014 Florian Zeitz --- Copyright (C) 2016-2017 Thilo Molitor +-- Copyright (C) 2016-2019 Thilo Molitor -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. @@ -116,7 +116,7 @@ end local function delayed_ack_function(session) - -- fire event only if configured to do so and our session is not hibernated or destroyed + -- fire event only if configured to do so and our session is not already hibernated or destroyed if delayed_ack_timeout > 0 and session.awaiting_ack and not session.hibernating and not session.destroyed then session.log("debug", "Firing event 'smacks-ack-delayed', queue = %d", @@ -171,7 +171,8 @@ session.awaiting_ack = false; session.awaiting_ack_timer = stoppable_timer(1e-06, function () -- session.log("debug", "*** SMACKS(3) ***: awaiting_ack=%s, hibernating=%s", tostring(session.awaiting_ack), tostring(session.hibernating)); - if not session.awaiting_ack and not session.hibernating then + -- only request ack if needed and our session is not already hibernated or destroyed + 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 })) session.awaiting_ack = true;