Comparison

mod_smacks/mod_smacks.lua @ 1732:2f9ee9ed6267

mod_smacks: Handle unacked messages in s2s queues
author Kim Alvefur <zash@zash.se>
date Mon, 11 May 2015 14:33:37 +0200
parent 1706:e4867211cddb
child 1733:9abd3dce619a
comparison
equal deleted inserted replaced
1731:b912cb8e0b3c 1732:2f9ee9ed6267
296 end 296 end
297 297
298 end 298 end
299 end); 299 end);
300 300
301 local function handle_s2s_destroyed(event)
302 local session = event.session;
303 local queue = session.outgoing_stanza_queue;
304 if queue and #queue > 0 then
305 session.log("warn", "Destroying session with %d unacked stanzas", #queue);
306 handle_unacked_stanzas(session);
307 end
308 end
309
310 module:hook("s2sout-destroyed", handle_s2s_destroyed);
311 module:hook("s2sin-destroyed", handle_s2s_destroyed);
312
301 function handle_resume(session, stanza, xmlns_sm) 313 function handle_resume(session, stanza, xmlns_sm)
302 if session.full_jid then 314 if session.full_jid then
303 session.log("warn", "Tried to resume after resource binding"); 315 session.log("warn", "Tried to resume after resource binding");
304 session.send(st.stanza("failed", { xmlns = xmlns_sm }) 316 session.send(st.stanza("failed", { xmlns = xmlns_sm })
305 :tag("unexpected-request", { xmlns = xmlns_errors }) 317 :tag("unexpected-request", { xmlns = xmlns_errors })