# HG changeset patch # User Kim Alvefur # Date 1413202789 -7200 # Node ID d4a4ed31567ecd259b1ba95eb7eebeeb668fcf0d # Parent 71af9c272d721fbecdfa066ee28e17e452ab5d2d mod_smacks: Trick session.send() into not returning nil or mod_message will act as if messages were not delivered diff -r 71af9c272d72 -r d4a4ed31567e mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Sun Oct 12 16:05:48 2014 +0200 +++ b/mod_smacks/mod_smacks.lua Mon Oct 13 14:19:49 2014 +0200 @@ -72,7 +72,6 @@ local is_stanza = stanza.attr and not stanza.attr.xmlns; if is_stanza and not stanza._cached then -- Stanza in default stream namespace local queue = session.outgoing_stanza_queue; - module:log("debug", "st.clone( %s ) -- %s a stanza", tostring(stanza), is_stanza and "is" or "is not"); local cached_stanza = st.clone(stanza); cached_stanza._cached = true; @@ -82,6 +81,10 @@ queue[#queue+1] = cached_stanza; session.log("debug", "#queue = %d", #queue); + if session.hibernating then + session.log("debug", "hibernating, stanza queued"); + return ""; -- Hack to make session.send() not return nil + end if #queue > max_unacked_stanzas then module:add_timer(0, function () if not session.awaiting_ack then @@ -91,12 +94,6 @@ end); end end - if session.hibernating then - session.log("debug", "hibernating, stanza queued") - -- The session is hibernating, no point in sending the stanza - -- over a dead connection. It will be delivered upon resumption. - return nil; -- or empty string? - end return stanza; end @@ -109,7 +106,6 @@ end local function wrap_session(session, resume) - -- Overwrite process_stanza() and send() local queue; if not resume then queue = {};