changeset 2674:c971b2cee2cc

mod_pinger: Try to solve smacks related issues, see #712
author tmolitor <thilo@eightysoft.de>
date Fri, 07 Apr 2017 23:34:40 +0200
parents 2e1a4740adee
children 101a2a0b8b33 d96831e46b64
files mod_pinger/mod_pinger.lua
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pinger/mod_pinger.lua	Thu Apr 06 10:14:00 2017 +0200
+++ b/mod_pinger/mod_pinger.lua	Fri Apr 07 23:34:40 2017 +0200
@@ -15,11 +15,13 @@
 	local session = watchdog.session;
 	if not session.idle_pinged then
 		session.idle_pinged = true;
-		if session.smacks and not session.awaiting_ack then
+		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" }));
+			session.send(st.iq({ type = "get", from = module.host, id = "idle-check" })
+					:tag("ping", { xmlns = "urn:xmpp:ping" }));
 		end
 		return ping_timeout; -- Call us again after ping_timeout
 	else
@@ -51,4 +53,4 @@
 
 -- 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.origin); end);
+module:hook("smacks-hibernation-end", function (event) watch_session(event.resumed); end);