Mercurial > prosody-modules
diff mod_smacks/mod_smacks.lua @ 927:a9dfa7232d88
Merge
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 12 Mar 2013 12:10:25 +0000 |
| parents | 720b8268778e |
| children | fabff75bfc3f |
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua Thu Nov 22 18:59:10 2012 +0000 +++ b/mod_smacks/mod_smacks.lua Tue Mar 12 12:10:25 2013 +0000 @@ -83,6 +83,11 @@ queue[#queue+1] = cached_stanza; end + if session.hibernating then + -- The session is hibernating, no point in sending the stanza + -- over a dead connection. It will be delivered upon resumption. + return true; + end local ok, err = _send(stanza); if ok and #queue > max_unacked_stanzas and not session.awaiting_ack and attr and not attr.xmlns then session.awaiting_ack = true; @@ -203,7 +208,7 @@ module:hook("pre-resource-unbind", function (event) local session, err = event.session, event.error; - if session.smacks and err ~= "session closed" then + if session.smacks and err then if not session.resumption_token then local queue = session.outgoing_stanza_queue; if #queue > 0 then @@ -244,6 +249,14 @@ end); module:hook_stanza(xmlns_sm, "resume", function (session, stanza) + if session.full_jid then + session.log("debug", "Tried to resume after resource binding"); + session.send(st.stanza("failed", sm_attr) + :tag("unexpected-request", { xmlns = xmlns_errors }) + ); + return true; + end + local id = stanza.attr.previd; local original_session = session_registry[id]; if not original_session then
