Changeset

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 2139:17408ddd34b0
children 2141:218a3d3f7f97
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
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]);