# HG changeset patch # User Matthew Wild # Date 1330966410 0 # Node ID ce39df945de1ae81a42844dee53ce51dc8077688 # Parent 7bdd02056e2b734853de4f79c4615adc891b63ff mod_smacks: Use pre-resource-unbind (0.9 feature) to fix reloadability and multiple host support diff -r 7bdd02056e2b -r ce39df945de1 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Tue Feb 28 14:37:42 2012 +0100 +++ b/mod_smacks/mod_smacks.lua Mon Mar 05 16:53:30 2012 +0000 @@ -198,8 +198,8 @@ end end -local _destroy_session = sessionmanager.destroy_session; -function sessionmanager.destroy_session(session, err) +module:hook("pre-resource-unbind", function (event) + local session, err = event.session, event.error; if session.smacks then if not session.resumption_token then local queue = session.outgoing_stanza_queue; @@ -229,19 +229,16 @@ session.log("debug", "Destroying session for hibernating too long"); session_registry[session.resumption_token] = nil; session.resumption_token = nil; - -- This recursion back into our destroy handler is to - -- make sure we still handle any queued stanzas sessionmanager.destroy_session(session); else session.log("debug", "Session resumed before hibernation timeout, all is well") end end); - return; -- Postpone destruction for now + return true; -- Postpone destruction for now end end - return _destroy_session(session, err); -end +end); module:hook_stanza(xmlns_sm, "resume", function (session, stanza) local id = stanza.attr.previd;