Mercurial > prosody-hg
comparison plugins/mod_debug_stanzas/watcher.lib.lua @ 14191:e86ede52bfbe 13.0
mod_debug_stanzas: Only clear active_filters when there are no subscribers
This fixes a potential leak when there are multiple concurrent stanza watchers
in progress and one quits.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 26 May 2026 11:46:45 +0100 |
| parents | 74b9e05af71e |
| children |
comparison
equal
deleted
inserted
replaced
| 14190:9b0a65e64697 | 14191:e86ede52bfbe |
|---|---|
| 57 end | 57 end |
| 58 end | 58 end |
| 59 if #active_filter.downstream == 0 then | 59 if #active_filter.downstream == 0 then |
| 60 filters.remove_filter(session, "stanzas/in", active_filter.filter_in); | 60 filters.remove_filter(session, "stanzas/in", active_filter.filter_in); |
| 61 filters.remove_filter(session, "stanzas/out", active_filter.filter_out); | 61 filters.remove_filter(session, "stanzas/out", active_filter.filter_out); |
| 62 end | 62 active_filters[session] = nil; |
| 63 active_filters[session] = nil; | 63 end |
| 64 end | 64 end |
| 65 | 65 |
| 66 local function unsubscribe_all_from_session(session, reason) | 66 local function unsubscribe_all_from_session(session, reason) |
| 67 local active_filter = active_filters[session]; | 67 local active_filter = active_filters[session]; |
| 68 if not active_filter then | 68 if not active_filter then |
