changeset 1881:3683eb95bc1a

mod_smacks: Add experimental resending of unacked messages in s2s queues (disabled by default)
author Kim Alvefur <zash@zash.se>
date Tue, 29 Sep 2015 21:54:40 +0200
parents a7c1f1b6ef05
children 99863a6a7b8c
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Tue Sep 29 14:56:46 2015 +0200
+++ b/mod_smacks/mod_smacks.lua	Tue Sep 29 21:54:40 2015 +0200
@@ -31,6 +31,7 @@
 
 local resume_timeout = module:get_option_number("smacks_hibernation_time", 300);
 local s2s_smacks = module:get_option_boolean("smacks_enabled_s2s", false);
+local s2s_resend = module:get_option_boolean("smacks_s2s_resend", false);
 local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0);
 local core_process_stanza = prosody.core_process_stanza;
 local sessionmanager = require"core.sessionmanager";
@@ -303,7 +304,14 @@
 	local queue = session.outgoing_stanza_queue;
 	if queue and #queue > 0 then
 		session.log("warn", "Destroying session with %d unacked stanzas", #queue);
-		handle_unacked_stanzas(session);
+		if s2s_resend then
+			for i = 1, #queue do
+				module:send(queue[i]);
+			end
+			session.outgoing_stanza_queue = nil;
+		else
+			handle_unacked_stanzas(session);
+		end
 	end
 end