diff mod_smacks/mod_smacks.lua @ 2140:3a94b3cd31e2

mod_smacks: added new events for hibernation start/end
author tmolitor <thilo@eightysoft.de>
date Sun, 27 Mar 2016 16:13:20 +0200
parents f1be45c9a742
children c472a454be61
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Sun Mar 27 20:09:29 2016 +0200
+++ b/mod_smacks/mod_smacks.lua	Sun Mar 27 16:13:20 2016 +0200
@@ -281,6 +281,7 @@
 			local hibernate_time = os_time(); -- Track the time we went into hibernation
 			session.hibernating = hibernate_time;
 			local resumption_token = session.resumption_token;
+			module:fire_event("smacks-hibernation-start", {origin = session, queue = session.outgoing_stanza_queue});
 			timer.add_task(resume_timeout, function ()
 				session.log("debug", "mod_smacks hibernation timeout reached...");
 				-- We need to check the current resumption token for this resource
@@ -378,6 +379,7 @@
 		-- Ok, we need to re-send any stanzas that the client didn't see
 		-- ...they are what is now left in the outgoing stanza queue
 		local queue = original_session.outgoing_stanza_queue;
+		module:fire_event("smacks-hibernation-end", {origin = session, queue = queue});
 		session.log("debug", "#queue = %d", #queue);
 		for i=1,#queue do
 			session.send(queue[i]);