Diff

mod_smacks/mod_smacks.lua @ 908:abf0f12fe75c

mod_smacks: Don't try to send stanzas to hibernating sessions. Fixes duplicate IQ replies on libevent.
author Kim Alvefur <zash@zash.se>
date Mon, 11 Feb 2013 19:21:31 +0100
parent 891:e089160c424b
child 925:720b8268778e
line wrap: on
line diff
--- 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;