# HG changeset patch # User Georg Lukas # Date 1528305610 -7200 # Node ID 5bf79bb3cf7edf43f82a0fc6a3e692e4a2f9d1f4 # Parent f04dbfad54073a8d470429182bfed1ff30bcfa4f Neuter 0198 from mod_pinger, fix #712 diff -r f04dbfad5407 -r 5bf79bb3cf7e mod_pinger/mod_pinger.lua --- a/mod_pinger/mod_pinger.lua Sun Jun 03 16:26:32 2018 +0200 +++ b/mod_pinger/mod_pinger.lua Wed Jun 06 19:20:10 2018 +0200 @@ -13,16 +13,14 @@ function check_session(watchdog) local session = watchdog.session; + if session.smacks then + unwatch_session(session); + return; + end if not session.idle_pinged then session.idle_pinged = true; - if session.smacks then - if not session.awaiting_ack then - session.send(st.stanza("r", { xmlns = session.smacks })) - end - else - session.send(st.iq({ type = "get", from = module.host, id = "idle-check" }) - :tag("ping", { xmlns = "urn:xmpp:ping" })); - end + session.send(st.iq({ type = "get", from = module.host, id = "idle-check" }) + :tag("ping", { xmlns = "urn:xmpp:ping" })); return ping_timeout; -- Call us again after ping_timeout else module:log("info", "Client %q silent for too long, closing...", session.full_jid); @@ -42,15 +40,11 @@ function unwatch_session(session) if session.idle_watchdog then + filters.remove_filter(session, "bytes/in", update_watchdog); session.idle_watchdog:cancel(); session.idle_watchdog = nil; - filters.remove_filter(session, "bytes/in", update_watchdog); end end module:hook("resource-bind", function (event) watch_session(event.session); end); module:hook("resource-unbind", function (event) unwatch_session(event.session); end); - --- handle smacks sessions properly (not pinging in hibernated state) -module:hook("smacks-hibernation-start", function (event) unwatch_session(event.origin); end); -module:hook("smacks-hibernation-end", function (event) watch_session(event.resumed); end);