Diff

mod_smacks/mod_smacks.lua @ 1406:7d76dd2310ef

mod_smacks: Add more debug logging
author Kim Alvefur <zash@zash.se>
date Wed, 07 May 2014 14:19:44 +0200
parent 1405:26a2092e289f
child 1407:b631c8a8b9e7
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Wed May 07 14:17:03 2014 +0200
+++ b/mod_smacks/mod_smacks.lua	Wed May 07 14:19:44 2014 +0200
@@ -91,8 +91,10 @@
 			end
 
 			queue[#queue+1] = cached_stanza;
+			session.log("debug", "#queue = %d", #queue);
 		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 true;
@@ -204,6 +206,7 @@
 	for i=1,math_min(handled_stanza_count,#queue) do
 		t_remove(origin.outgoing_stanza_queue, 1);
 	end
+	origin.log("debug", "#queue = %d", #queue);
 	origin.last_acknowledged_stanza = origin.last_acknowledged_stanza + handled_stanza_count;
 	return true;
 end
@@ -333,9 +336,11 @@
 		-- Ok, we need to re-send any stanzas that the client didn't see
 		-- ...they are what is now left in the outgoing stanza queue
 		local queue = original_session.outgoing_stanza_queue;
+		session.log("debug", "#queue = %d", #queue);
 		for i=1,#queue do
 			session.send(queue[i]);
 		end
+		session.log("debug", "#queue = %d -- after send", #queue);
 	else
 		module:log("warn", "Client %s@%s[%s] tried to resume stream for %s@%s[%s]",
 			session.username or "?", session.host or "?", session.type,