mod_smacks: Don't try to send stanzas to hibernating sessions. Fixes duplicate IQ replies on libevent.
authorKim Alvefur <zash@zash.se>
Mon, 11 Feb 2013 19:21:31 +0100
changeset 908 abf0f12fe75c
parent 907 c06369259aee
child 909 ec4c6e8f277d
mod_smacks: Don't try to send stanzas to hibernating sessions. Fixes duplicate IQ replies on libevent.
mod_smacks/mod_smacks.lua
--- a/mod_smacks/mod_smacks.lua	Sun Feb 10 23:32:15 2013 +0000
+++ b/mod_smacks/mod_smacks.lua	Mon Feb 11 19:21:31 2013 +0100
@@ -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;