Software /
code /
prosody
Comparison
plugins/mod_s2s.lua @ 13555:42b98ee73ca8
mod_s2s: Fix counting items in outgoing stanza queue (in logs)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 10 Nov 2024 15:06:00 +0100 |
parent | 13554:902d25cd0557 |
child | 13556:d3649ae194ab |
comparison
equal
deleted
inserted
replaced
13554:902d25cd0557 | 13555:42b98ee73ca8 |
---|---|
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, session.to_host); | 138 session.log("info", "Sending error replies for %d queued stanzas because of failed outgoing connection to %s", sendq.items(), 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, session.to_host); | 369 session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", sendq.items(), 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 |