aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_smacks.lua
Commit message (Collapse)AuthorAgeFilesLines
...
* mod_smacks: Stop stanzas from being queued on hibernation timeoutKim Alvefur2021-12-161-0/+1
| | | | | | | | | | This overloads that flag a bit, but it has the intended effect of stopping outgoing_stanza_filter() from queueing stanzas. Fixes a traceback because of the queue having been removed somewhere around here, since it is no longer needed. Thanks Martin for reporting
* mod_smacks: Limit queue memory consumption using new utilKim Alvefur2021-12-141-51/+72
| | | | | | | | | This brings back the queue size limit that was once added, then removed because destroying the session when reaching the limit was not great. Instead, the queue wraps and overwrites the oldest unacked stanza on the assumption that it will probably be acked anyway and thus does not need to be delivered. If those discarded stanzas turn out to be needed on resumption then the resumption fails.
* mod_smacks: Set a watchdog to watch sleeping sessionsKim Alvefur2021-12-021-59/+27
| | | | | Extending the timeout by poking the watchdog, and letting it go on resumption, should be much better than the previous method.
* mod_smacks: Switch storage for tracking resumption tokensKim Alvefur2021-12-021-40/+5
| | | | | | | | All that was a complicated way to limit the number of resumable sessions. Let's control resource usage some other way. This leaves the essence of mapping resumption tokens to live sessions. This keeps resumption state across reloads.
* mod_smacks: Clear resumption token from persistent storage on resumptionKim Alvefur2021-12-011-0/+1
|
* mod_smacks: Persist old counter values to storageKim Alvefur2021-12-011-7/+5
| | | | | | | | | This allows clients that try to resume a session after a server restart to at least know which of their pending outgoing stanzas were received and which need to be re-sent. This removes the limit on how many of those counters are kept, which should be fixed eventually.
* mod_smacks: Remove now unused variable [luacheck]Kim Alvefur2021-12-151-1/+1
|
* mod_smacks: Remove unused eventKim Alvefur2021-12-151-1/+0
| | | | | Since nothing uses it. Some equivalent functionality may return in the future.
* mod_smacks: Fix typoKim Alvefur2021-12-151-1/+1
|
* mod_smacks: Flag both sessions to prevent duplicating queue on resumptionKim Alvefur2021-12-141-0/+3
| | | | | | | I have no idea what is going on in this code, which session is which? Something has one of the sessions as an upvalue which is where the filter checks for it.
* mod_smacks: Increment a counter for each resumptionKim Alvefur2021-12-061-0/+1
| | | | | Encountered what looks like a bug where after *many* resumptions, part of the queue was not acked.
* mod_smacks: Back out 48f8fa6cea7b - back in a86ae74da96c againKim Alvefur2021-12-131-2/+4
| | | | Maybe it works now with the session patching in the previous commit
* mod_smacks: Patch various self-references on the resumed sessionKim Alvefur2021-12-131-0/+5
| | | | | The number of places where the session is an upvalue to its own methods is too high!
* mod_smacks: Back out a86ae74da96c: Fixed one problem, caused anotherKim Alvefur2021-12-131-4/+2
| | | | | | | | As per a86ae74da96c the 'session' object here is the wrong session, so the attempt to block stanzas from being added to the queue twice did not work causing something of a leak. Instead we have a leak of the previous session.
* mod_smacks: Back out def20683c161Kim Alvefur2021-12-131-1/+0
| | | | The attempted fix completely broke everything after resumption.
* mod_smacks: Update reference to session from send()Kim Alvefur2021-12-131-0/+1
| | | | | | a86ae74da96c caused the stanza queue to double on resumption because session.send() keeps a reference to the session which is what gets passed to filters, so the added flag was not seen in the filter.
* mod_smacks: Include reason for destroying session on hibernation timeoutKim Alvefur2021-12-121-1/+1
| | | | To aid in debugging
* mod_smacks: Refactor, simplify, optimizeKim Alvefur2021-12-031-4/+2
| | | | | Since reply.attr.to will be the .attr.from of the input we can check this earlier and avoid constructing the reply at all.
* mod_smacks: Use function to construct error replyKim Alvefur2021-12-031-5/+1
| | | | Did error_reply() not exist when mod_smacks was first created?
* mod_smacks: Remove obsolete commentKim Alvefur2021-12-021-5/+0
| | | | It dates back to the initial commit in prosody-modules 9a7671720dec
* mod_smacks: Avoid duplicated queueing using flag on session instead of stanzaKim Alvefur2021-12-021-2/+4
| | | | Mutating the stanza like this is Really Bad Practice.
* mod_smacks: Remove dead conditionalKim Alvefur2021-12-021-1/+1
| | | | | `cached_stanza` can't be falsy because util.stanza.clone() would have thrown rather than return nil, or `._cached=true` would have.
* mod_smacks: Ensure hibernating session is not connectedKim Alvefur2021-12-021-0/+3
| | | | | Turns out that if you destroy a session from inside prosody, it goes into hibernation but stays connected and continues processing stanzas.
* mod_smacks: Reorder imports etcKim Alvefur2021-12-011-13/+15
| | | | Mostly sorted by name of import (sort -k4) and grouped by kind
* mod_smacks: Fix empty cache checkKim Alvefur2021-12-011-1/+1
| | | | | In Lua, every value except `nil` and `false` are considered true in boolean expressions, even `0` as here, which means this was dead code.
* mod_smacks: Use stanza type checking function for correctnessKim Alvefur2021-12-011-1/+1
| | | | | Non-stanza tables with an 'attr' field might be rare in Prosody, but better to be Correct
* mod_smacks: Remove redundant fieldsKim Alvefur2021-12-011-7/+1
| | | | | | Given that the registry is scoped per user and the module is scoped per host, there seems no point to checking or storing both username and host here.
* mod_smacks: Factor out formatting of 'h' valueKim Alvefur2021-12-011-4/+6
|
* mod_smacks: Remove dead legacy code for 0.10Kim Alvefur2021-12-011-17/+0
|
* mod_smacks: Use new pre-session-close event instead of monkeypatchKim Alvefur2021-12-011-13/+16
| | | | Much cleaner.
* mod_smacks: Remove left-over debug loggingKim Alvefur2021-11-271-1/+0
| | | | | Wrong level, missing argument, whatever it was meant to shed light on has been resolved and forgotten.
* mod_smacks: Optimize scheduling of ack requestsKim Alvefur2021-11-241-1/+2
| | | | | | Taking advantage of the new callbacks added in dcf38ac6a38c and 9c450185bac1 avoids extra timers, extra syscalls and sending the `<r>` in its own TCP segment, improving efficiency.
* mod_smacks: Refactor ack requesting to avoid some timer roundtripsKim Alvefur2021-11-241-56/+62
| | | | | | | | | | The function was too large to comprehend! Breaking it up helps readability and reuse. The timer round rip is only to avoid ordering weirdness when sending from inside a stanza filter. No need when handling <r> and <a> CSI interactions both boiled down to sending an <r> immediately.
* mod_smacks: Fix timer lifetimes to follow session instead of moduleKim Alvefur2021-11-241-8/+12
| | | | | | | module:add_timer() creates a timer that stops working after the module is reloaded or unloaded, in order to prevent leaks. However, when the timers control vital session behavior, breakage occurs after reload. E.g. sessions would stop requesting acks and stop responding to acks.
* mod_smacks: Clean up compat code etcKim Alvefur2021-11-241-54/+39
| | | | | | | | Unstoppable stoppable timer compat not needed since 26f54b462601 ca 0.11.0 module:hook_stanza was renamed in 2012 No idea what was going on with the indentation and such
* mod_smacks: Import from prosody-modules @ eb63890ae8fcKim Alvefur2021-11-161-0/+690