Diff

mod_smacks/mod_smacks.lua @ 2744:f70c02c14161

mod_smacks: Trigger event smacks-hibernation-end after queue resend This is more sensible and allows other modules to send out stanzas when handling this event without messing with the order of stanzas.
author tmolitor <thilo@eightysoft.de>
date Fri, 18 Aug 2017 00:56:38 +0200
parent 2727:91cbeb6ad987
child 2756:dbba101601b4
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Thu Aug 17 21:34:56 2017 +0200
+++ b/mod_smacks/mod_smacks.lua	Fri Aug 18 00:56:38 2017 +0200
@@ -509,7 +509,6 @@
 		-- 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, resumed = original_session, queue = queue});
 		original_session.log("debug", "#queue = %d", #queue);
 		for i=1,#queue do
 			original_session.send(queue[i]);
@@ -519,6 +518,7 @@
 			session.log("warn", "Tried to send stanza on old session migrated by smacks resume (maybe there is a bug?): %s", tostring(stanza));
 			return false;
 		end
+		module:fire_event("smacks-hibernation-end", {origin = session, resumed = original_session, queue = queue});
 		request_ack_if_needed(original_session, true);
 	else
 		module:log("warn", "Client %s@%s[%s] tried to resume stream for %s@%s[%s]",