Changeset

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
parents 2743:1fa9620220e3
children 2745:b62cec32680e
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
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]",