comparison plugins/mod_s2s.lua @ 13557:63492b6e7fb6

mod_s2s: Really fix logging of outgoing stanza queue counts Some confusion happened in 42b98ee73ca8, possibly because .count() returns the items?
author Kim Alvefur <zash@zash.se>
date Mon, 11 Nov 2024 08:49:57 +0100
parents d3649ae194ab
children 750ff9f579e2
comparison
equal deleted inserted replaced
13556:d3649ae194ab 13557:63492b6e7fb6
133 133
134 local bouncy_stanzas = { message = true, presence = true, iq = true }; 134 local bouncy_stanzas = { message = true, presence = true, iq = true };
135 local function bounce_sendq(session, reason) 135 local function bounce_sendq(session, reason)
136 local sendq = session.sendq; 136 local sendq = session.sendq;
137 if not sendq then return; end 137 if not sendq then return; end
138 session.log("info", "Sending error replies for %d queued stanzas because of failed outgoing connection to %s", sendq.items(), session.to_host); 138 session.log("info", "Sending error replies for %d queued stanzas because of failed outgoing connection to %s", sendq.count(), session.to_host);
139 local dummy = { 139 local dummy = {
140 type = "s2sin"; 140 type = "s2sin";
141 send = function () 141 send = function ()
142 (session.log or log)("error", "Replying to to an s2s error reply, please report this! Traceback: %s", traceback()); 142 (session.log or log)("error", "Replying to to an s2s error reply, please report this! Traceback: %s", traceback());
143 end; 143 end;
364 module:context(to):fire_event("s2sin-established", event_data); 364 module:context(to):fire_event("s2sin-established", event_data);
365 end 365 end
366 366
367 if session.direction == "outgoing" then 367 if session.direction == "outgoing" then
368 if sendq then 368 if sendq then
369 session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", sendq.items(), session.to_host); 369 session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", sendq.count(), session.to_host);
370 local send = session.sends2s; 370 local send = session.sends2s;
371 for stanza in sendq:consume() do 371 for stanza in sendq:consume() do
372 -- TODO check send success 372 -- TODO check send success
373 send(stanza); 373 send(stanza);
374 end 374 end