aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-29 21:56:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-29 21:56:05 +0100
commit5e31d656fef5a30d12aa1fc264cdb1216d9c16b7 (patch)
tree51838ce321f56e9b3eddc6512fcb033c9066b0ca /src/libutil
parentdca87323aacee1e8f5ac38cc0b251d40a32adaa2 (diff)
downloadrspamd-5e31d656fef5a30d12aa1fc264cdb1216d9c16b7.tar.gz
rspamd-5e31d656fef5a30d12aa1fc264cdb1216d9c16b7.zip
Implement resorting.
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/expression.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/expression.c b/src/libutil/expression.c
index 83ee76a07..d656db37b 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -929,6 +929,13 @@ rspamd_process_expression (struct rspamd_expression *expr, gint flags,
if (expr->evals == expr->next_resort) {
expr->next_resort = ottery_rand_range (MAX_RESORT_EVALS) +
MIN_RESORT_EVALS;
+ /* Set priorities for branches */
+ g_node_traverse (expr->ast, G_POST_ORDER, G_TRAVERSE_ALL, -1,
+ rspamd_ast_priority_traverse, expr);
+
+ /* Now set less expensive branches to be evaluated first */
+ g_node_traverse (expr->ast, G_POST_ORDER, G_TRAVERSE_NON_LEAVES, -1,
+ rspamd_ast_resort_traverse, NULL);
}
return ret;