*/ | */ | ||||
gboolean rspamd_symcache_process_symbols(struct rspamd_task *task, | gboolean rspamd_symcache_process_symbols(struct rspamd_task *task, | ||||
struct rspamd_symcache *cache, | struct rspamd_symcache *cache, | ||||
gint stage); | |||||
guint stage); | |||||
/** | /** | ||||
* Return statistics about the cache as ucl object (array of objects one per item) | * Return statistics about the cache as ucl object (array of objects one per item) |
gboolean | gboolean | ||||
rspamd_symcache_process_symbols(struct rspamd_task *task, | rspamd_symcache_process_symbols(struct rspamd_task *task, | ||||
struct rspamd_symcache *cache, | struct rspamd_symcache *cache, | ||||
gint stage) | |||||
guint stage) | |||||
{ | { | ||||
auto *real_cache = C_API_SYMCACHE(cache); | auto *real_cache = C_API_SYMCACHE(cache); | ||||
/*- | |||||
* Copyright 2022 Vsevolod Stakhov | |||||
/* | |||||
* Copyright 2023 Vsevolod Stakhov | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | ||||
* | * | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | * | ||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
auto symcache_runtime::process_symbols(struct rspamd_task *task, symcache &cache, int stage) -> bool | |||||
auto symcache_runtime::process_symbols(struct rspamd_task *task, symcache &cache, unsigned int stage) -> bool | |||||
{ | { | ||||
msg_debug_cache_task("symbols processing stage at pass: %d", stage); | msg_debug_cache_task("symbols processing stage at pass: %d", stage); | ||||
auto symcache_runtime::process_pre_postfilters(struct rspamd_task *task, | auto symcache_runtime::process_pre_postfilters(struct rspamd_task *task, | ||||
symcache &cache, | symcache &cache, | ||||
int start_events, | int start_events, | ||||
int stage) -> bool | |||||
unsigned int stage) -> bool | |||||
{ | { | ||||
auto saved_priority = std::numeric_limits<int>::min(); | auto saved_priority = std::numeric_limits<int>::min(); | ||||
auto all_done = true; | auto all_done = true; |
/*- | |||||
* Copyright 2022 Vsevolod Stakhov | |||||
/* | |||||
* Copyright 2023 Vsevolod Stakhov | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | ||||
* | * | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | * | ||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | ||||
auto process_symbol(struct rspamd_task *task, symcache &cache, cache_item *item, | auto process_symbol(struct rspamd_task *task, symcache &cache, cache_item *item, | ||||
cache_dynamic_item *dyn_item) -> bool; | cache_dynamic_item *dyn_item) -> bool; | ||||
/* Specific stages of the processing */ | /* Specific stages of the processing */ | ||||
auto process_pre_postfilters(struct rspamd_task *task, symcache &cache, int start_events, int stage) -> bool; | |||||
auto process_pre_postfilters(struct rspamd_task *task, symcache &cache, int start_events, unsigned int stage) -> bool; | |||||
auto process_filters(struct rspamd_task *task, symcache &cache, int start_events) -> bool; | auto process_filters(struct rspamd_task *task, symcache &cache, int start_events) -> bool; | ||||
auto check_metric_limit(struct rspamd_task *task) -> bool; | auto check_metric_limit(struct rspamd_task *task) -> bool; | ||||
auto check_item_deps(struct rspamd_task *task, symcache &cache, cache_item *item, | auto check_item_deps(struct rspamd_task *task, symcache &cache, cache_item *item, | ||||
* @param stage | * @param stage | ||||
* @return | * @return | ||||
*/ | */ | ||||
auto process_symbols(struct rspamd_task *task, symcache &cache, int stage) -> bool; | |||||
auto process_symbols(struct rspamd_task *task, symcache &cache, unsigned int stage) -> bool; | |||||
/** | /** | ||||
* Finalize execution of some item in the cache | * Finalize execution of some item in the cache |
} | } | ||||
} | } | ||||
for (guint i = m->nactions - 1; i >= 0; i--) { | |||||
for (guint i = m->nactions; i-- > 0;) { | |||||
struct rspamd_action_config *action_lim = &m->actions_config[i]; | struct rspamd_action_config *action_lim = &m->actions_config[i]; | ||||