Mercurial > prosody-modules
comparison mod_smacks/mod_smacks.lua @ 2713:eea1d5bac451
mod_smacks: Fix delayed_ack event
After the first delayed ack every queued stanza should immediately
trigger the delayed_ack event.
| author | tmolitor <thilo@eightysoft.de> |
|---|---|
| date | Mon, 08 May 2017 19:36:37 +0200 |
| parents | d96831e46b64 |
| children | 91cbeb6ad987 |
comparison
equal
deleted
inserted
replaced
| 2712:d89ab70808f6 | 2713:eea1d5bac451 |
|---|---|
| 168 end); | 168 end); |
| 169 end | 169 end |
| 170 end | 170 end |
| 171 end); | 171 end); |
| 172 end | 172 end |
| 173 -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue | 173 end |
| 174 -- and there isn't already a timer for this event running. | 174 |
| 175 -- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event | 175 -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue |
| 176 -- would not trigger this event (again). | 176 -- and there isn't already a timer for this event running. |
| 177 if #queue > max_unacked_stanzas and session.awaiting_ack and session.delayed_ack_timer == nil then | 177 -- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event |
| 178 session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); | 178 -- would not trigger this event (again). |
| 179 delayed_ack_function(session); | 179 if #queue > max_unacked_stanzas and session.awaiting_ack and session.delayed_ack_timer == nil then |
| 180 end | 180 session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); |
| 181 end | 181 delayed_ack_function(session); |
| 182 end | |
| 183 | |
| 182 session.last_queue_count = #queue; | 184 session.last_queue_count = #queue; |
| 183 end | 185 end |
| 184 | 186 |
| 185 local function outgoing_stanza_filter(stanza, session) | 187 local function outgoing_stanza_filter(stanza, session) |
| 186 local is_stanza = stanza.attr and not stanza.attr.xmlns and not stanza.name:find":"; | 188 local is_stanza = stanza.attr and not stanza.attr.xmlns and not stanza.name:find":"; |
