comparison mod_smacks/mod_smacks.lua @ 1416:7ddb522d9b28

mod_smacks: Fix logging (Thanks Ge0rG)
author Kim Alvefur <zash@zash.se>
date Thu, 22 May 2014 08:30:16 +0200
parents ed2a9c00b5c4
children feca77ad88ac
comparison
equal deleted inserted replaced
1415:8791fa8a18c8 1416:7ddb522d9b28
203 origin:close{ condition = "invalid-xml"; text = "Missing or invalid 'h' attribute"; }; 203 origin:close{ condition = "invalid-xml"; text = "Missing or invalid 'h' attribute"; };
204 end 204 end
205 local handled_stanza_count = h-origin.last_acknowledged_stanza; 205 local handled_stanza_count = h-origin.last_acknowledged_stanza;
206 local queue = origin.outgoing_stanza_queue; 206 local queue = origin.outgoing_stanza_queue;
207 if handled_stanza_count > #queue then 207 if handled_stanza_count > #queue then
208 session.log("warn", "The client says it handled %d new stanzas, but we only sent %d :)", 208 origin.log("warn", "The client says it handled %d new stanzas, but we only sent %d :)",
209 handled_stanza_count, #queue); 209 handled_stanza_count, #queue);
210 session.log("debug", "Client h: %d, our h: %d", tonumber(stanza.attr.h), origin.last_acknowledged_stanza); 210 origin.log("debug", "Client h: %d, our h: %d", tonumber(stanza.attr.h), origin.last_acknowledged_stanza);
211 for i=1,#queue do 211 for i=1,#queue do
212 session.log("debug", "Q item %d: %s", i, tostring(queue[i])); 212 origin.log("debug", "Q item %d: %s", i, tostring(queue[i]));
213 end 213 end
214 end 214 end
215 for i=1,math_min(handled_stanza_count,#queue) do 215 for i=1,math_min(handled_stanza_count,#queue) do
216 t_remove(origin.outgoing_stanza_queue, 1); 216 t_remove(origin.outgoing_stanza_queue, 1);
217 end 217 end