GPtrArray *items_by_id;
struct symcache_order *items_by_order;
GPtrArray *filters;
- GPtrArray *prefilters_empty;
GPtrArray *prefilters;
GPtrArray *postfilters;
GPtrArray *composites;
}
}
- g_ptr_array_sort_with_data (cache->prefilters_empty, prefilters_cmp, cache);
g_ptr_array_sort_with_data (cache->prefilters, prefilters_cmp, cache);
g_ptr_array_sort_with_data (cache->postfilters, postfilters_cmp, cache);
g_ptr_array_sort_with_data (cache->idempotent, postfilters_cmp, cache);
if (item->type & SYMBOL_TYPE_PREFILTER) {
type_str = "prefilter";
-
- if (item->type & SYMBOL_TYPE_EMPTY) {
- /* Executed before mime parsing stage */
- g_ptr_array_add (cache->prefilters_empty, item);
- item->container = cache->prefilters_empty;
- }
- else {
- g_ptr_array_add (cache->prefilters, item);
- item->container = cache->prefilters;
- }
+ g_ptr_array_add (cache->prefilters, item);
+ item->container = cache->prefilters;
}
else if (item->type & SYMBOL_TYPE_IDEMPOTENT) {
type_str = "idempotent";
rspamd_mempool_delete (cache->static_pool);
g_ptr_array_free (cache->filters, TRUE);
g_ptr_array_free (cache->prefilters, TRUE);
- g_ptr_array_free (cache->prefilters_empty, TRUE);
g_ptr_array_free (cache->postfilters, TRUE);
g_ptr_array_free (cache->idempotent, TRUE);
g_ptr_array_free (cache->composites, TRUE);
cache->items_by_id = g_ptr_array_new ();
cache->filters = g_ptr_array_new ();
cache->prefilters = g_ptr_array_new ();
- cache->prefilters_empty = g_ptr_array_new ();
cache->postfilters = g_ptr_array_new ();
cache->idempotent = g_ptr_array_new ();
cache->composites = g_ptr_array_new ();
start_events_pending = rspamd_session_events_pending (task->s);
switch (stage) {
- case RSPAMD_TASK_STAGE_PRE_FILTERS_EMPTY:
- /* Check for prefilters */
- saved_priority = G_MININT;
- all_done = TRUE;
-
- for (i = 0; i < (gint) cache->prefilters_empty->len; i++) {
- item = g_ptr_array_index (cache->prefilters_empty, i);
- dyn_item = rspamd_symcache_get_dynamic (checkpoint, item);
-
- if (RSPAMD_TASK_IS_SKIPPED (task)) {
- return TRUE;
- }
-
- if (!CHECK_START_BIT (checkpoint, dyn_item) &&
- !CHECK_FINISH_BIT (checkpoint, dyn_item)) {
-
- if (checkpoint->has_slow) {
- /* Delay */
- checkpoint->has_slow = FALSE;
-
- return FALSE;
- }
- /* Check priorities */
- if (saved_priority == G_MININT) {
- saved_priority = item->priority;
- }
- else {
- if (item->priority < saved_priority &&
- rspamd_session_events_pending (task->s) > start_events_pending) {
- /*
- * Delay further checks as we have higher
- * priority filters to be processed
- */
- return FALSE;
- }
- }
-
- rspamd_symcache_check_symbol (task, cache, item,
- checkpoint);
- all_done = FALSE;
- }
- }
-
- break;
-
case RSPAMD_TASK_STAGE_PRE_FILTERS:
/* Check for prefilters */
saved_priority = G_MININT;
RSPAMD_TASK_STAGE_CONNECT = (1u << 0u),
RSPAMD_TASK_STAGE_ENVELOPE = (1u << 1u),
RSPAMD_TASK_STAGE_READ_MESSAGE = (1u << 2u),
- RSPAMD_TASK_STAGE_PRE_FILTERS_EMPTY = (1u << 3u),
- RSPAMD_TASK_STAGE_PROCESS_MESSAGE = (1u << 4u),
- RSPAMD_TASK_STAGE_PRE_FILTERS = (1u << 5u),
- RSPAMD_TASK_STAGE_FILTERS = (1u << 6u),
- RSPAMD_TASK_STAGE_CLASSIFIERS_PRE = (1u << 7u),
- RSPAMD_TASK_STAGE_CLASSIFIERS = (1u << 8u),
- RSPAMD_TASK_STAGE_CLASSIFIERS_POST = (1u << 9u),
- RSPAMD_TASK_STAGE_COMPOSITES = (1u << 10u),
- RSPAMD_TASK_STAGE_POST_FILTERS = (1u << 11u),
- RSPAMD_TASK_STAGE_LEARN_PRE = (1u << 12u),
- RSPAMD_TASK_STAGE_LEARN = (1u << 13u),
- RSPAMD_TASK_STAGE_LEARN_POST = (1u << 14u),
- RSPAMD_TASK_STAGE_COMPOSITES_POST = (1u << 15u),
- RSPAMD_TASK_STAGE_IDEMPOTENT = (1u << 16u),
- RSPAMD_TASK_STAGE_DONE = (1u << 17u),
- RSPAMD_TASK_STAGE_REPLIED = (1u << 18u)
+ RSPAMD_TASK_STAGE_PROCESS_MESSAGE = (1u << 3u),
+ RSPAMD_TASK_STAGE_PRE_FILTERS = (1u << 4u),
+ RSPAMD_TASK_STAGE_FILTERS = (1u << 5u),
+ RSPAMD_TASK_STAGE_CLASSIFIERS_PRE = (1u << 6u),
+ RSPAMD_TASK_STAGE_CLASSIFIERS = (1u << 7u),
+ RSPAMD_TASK_STAGE_CLASSIFIERS_POST = (1u << 8u),
+ RSPAMD_TASK_STAGE_COMPOSITES = (1u << 9u),
+ RSPAMD_TASK_STAGE_POST_FILTERS = (1u << 10u),
+ RSPAMD_TASK_STAGE_LEARN_PRE = (1u << 11u),
+ RSPAMD_TASK_STAGE_LEARN = (1u << 12u),
+ RSPAMD_TASK_STAGE_LEARN_POST = (1u << 13u),
+ RSPAMD_TASK_STAGE_COMPOSITES_POST = (1u << 14u),
+ RSPAMD_TASK_STAGE_IDEMPOTENT = (1u << 15u),
+ RSPAMD_TASK_STAGE_DONE = (1u << 16u),
+ RSPAMD_TASK_STAGE_REPLIED = (1u << 17u)
};
#define RSPAMD_TASK_PROCESS_ALL (RSPAMD_TASK_STAGE_CONNECT | \
RSPAMD_TASK_STAGE_ENVELOPE | \
- RSPAMD_TASK_STAGE_PRE_FILTERS_EMPTY | \
RSPAMD_TASK_STAGE_READ_MESSAGE | \
RSPAMD_TASK_STAGE_PRE_FILTERS | \
RSPAMD_TASK_STAGE_PROCESS_MESSAGE | \