/* Process cache item */
if (symbol_result && task->cfg->cache && symbol_result->sym && symbol_result->nshots == 1) {
rspamd_symcache_inc_frequency (task->cfg->cache,
- symbol_result->sym->cache_item);
+ symbol_result->sym->cache_item,
+ symbol_result->sym->name);
}
}
else if (new_symbol) {
/* Process cache item */
if (symbol_result && task->cfg->cache && symbol_result->sym && symbol_result->nshots == 1) {
rspamd_symcache_inc_frequency (task->cfg->cache,
- symbol_result->sym->cache_item);
+ symbol_result->sym->cache_item,
+ symbol_result->sym->name);
}
}
}
* @param symbol
*/
void rspamd_symcache_inc_frequency (struct rspamd_symcache *_cache,
- struct rspamd_symcache_item *item);
+ struct rspamd_symcache_item *item,
+ const gchar *sym_name);
/**
* Add delayed dependency that is resolved on cache post-load routine
}
void
-rspamd_symcache_inc_frequency(struct rspamd_symcache *_cache, struct rspamd_symcache_item *item)
+rspamd_symcache_inc_frequency(struct rspamd_symcache *_cache, struct rspamd_symcache_item *item,
+ const char *sym_name)
{
auto *real_item = C_API_SYMCACHE_ITEM(item);
if (real_item) {
- real_item->inc_frequency();
+ real_item->inc_frequency(sym_name);
}
}
/**
* Increase frequency for a symbol
*/
- auto inc_frequency() -> void {
+ auto inc_frequency(const char *sym_name) -> void {
g_atomic_int_inc(&st->hits);
+
+ if (sym_name && symbol != sym_name && !is_virtual()) {
+ /* Likely a callback symbol with some virtual symbol that needs to be adjusted */
+ for (const auto &cld : get_children().value().get()) {
+ if (cld->get_name() == sym_name) {
+ cld->inc_frequency(sym_name);
+ }
+ }
+ }
}
/**