commit 66b22c2: [Minor] Some symcache neats
Vsevolod Stakhov
vsevolod at rspamd.com
Thu May 5 21:56:04 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-05-05 22:11:36 +0100
URL: https://github.com/rspamd/rspamd/commit/66b22c2eee1b4c13f55c8057b3237a70baf089b0
[Minor] Some symcache neats
---
src/libserver/symcache/symcache_impl.cxx | 29 +++++++++++++----------------
src/libserver/symcache/symcache_runtime.cxx | 4 ++--
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/libserver/symcache/symcache_impl.cxx b/src/libserver/symcache/symcache_impl.cxx
index ab1b41fc4..8da0cbecb 100644
--- a/src/libserver/symcache/symcache_impl.cxx
+++ b/src/libserver/symcache/symcache_impl.cxx
@@ -1027,24 +1027,21 @@ symcache::process_settings_elt(struct rspamd_config_settings_elt *elt) -> void
if (item != nullptr) {
if (item->is_virtual()) {
- if (!(item->flags & SYMBOL_TYPE_GHOST)) {
- auto *parent = get_item_by_name_mut(sym, true);
-
- if (parent) {
- if (elt->symbols_disabled &&
- ucl_object_lookup(elt->symbols_disabled, parent->symbol.data())) {
- msg_err_cache ("conflict in %s: cannot enable disabled symbol %s, "
- "wanted to enable symbol %s",
- elt->name, parent->symbol.data(), sym);
- continue;
- }
-
- parent->exec_only_ids.add_id(id, static_pool);
- msg_debug_cache ("allow just execution of symbol %s for settings %ud (%s)",
- parent->symbol.data(), id, elt->name);
+ auto *parent = get_item_by_name_mut(sym, true);
+
+ if (parent) {
+ if (elt->symbols_disabled &&
+ ucl_object_lookup(elt->symbols_disabled, parent->symbol.data())) {
+ msg_err_cache ("conflict in %s: cannot enable disabled symbol %s, "
+ "wanted to enable symbol %s",
+ elt->name, parent->symbol.data(), sym);
+ continue;
}
+
+ parent->exec_only_ids.add_id(id, static_pool);
+ msg_debug_cache ("allow just execution of symbol %s for settings %ud (%s)",
+ parent->symbol.data(), id, elt->name);
}
- /* Ignore ghosts */
}
item->allowed_ids.add_id(id, static_pool);
diff --git a/src/libserver/symcache/symcache_runtime.cxx b/src/libserver/symcache/symcache_runtime.cxx
index 7ee8b9cd9..1e334230b 100644
--- a/src/libserver/symcache/symcache_runtime.cxx
+++ b/src/libserver/symcache/symcache_runtime.cxx
@@ -119,6 +119,7 @@ symcache_runtime::process_settings(struct rspamd_task *task, const symcache &cac
const auto *enabled = ucl_object_lookup(task->settings, "symbols_enabled");
if (enabled) {
+ msg_debug_cache_task("disable all symbols as `symbols_enabled` is found");
/* Disable all symbols but selected */
disable_all_symbols(SYMBOL_TYPE_EXPLICIT_DISABLE);
already_disabled = true;
@@ -159,9 +160,8 @@ symcache_runtime::process_settings(struct rspamd_task *task, const symcache &cac
auto symcache_runtime::disable_all_symbols(int skip_mask) -> void
{
- for (auto i = 0; i < order->size(); i++) {
+ for (auto [i, item] : rspamd::enumerate(order->d)) {
auto *dyn_item = &dynamic_items[i];
- const auto &item = order->d[i];
if (!(item->get_flags() & skip_mask)) {
dyn_item->finished = true;
More information about the Commits
mailing list