From 76a3ba9cdff99c6b7de8ac4334a7955f80a7361b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 18 Aug 2019 11:05:32 +0100 Subject: [PATCH] [Minor] Fix processing of the skipped tasks (e.g. ping) --- src/libserver/composites.c | 2 +- src/libserver/protocol.c | 2 ++ src/libserver/rspamd_symcache.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libserver/composites.c b/src/libserver/composites.c index 33926f6e5..8471d0e93 100644 --- a/src/libserver/composites.c +++ b/src/libserver/composites.c @@ -695,7 +695,7 @@ composites_metric_callback (struct rspamd_scan_result *metric_res, void rspamd_make_composites (struct rspamd_task *task) { - if (task->result) { + if (task->result && !RSPAMD_TASK_IS_SKIPPED (task)) { composites_metric_callback (task->result, task); } } diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index ef8700340..a7abc5947 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -177,6 +177,8 @@ rspamd_protocol_handle_url (struct rspamd_task *task, if (COMPARE_CMD (p, MSG_CMD_PING, pathlen)) { msg_debug_protocol ("got ping command"); task->cmd = CMD_PING; + task->flags |= RSPAMD_TASK_FLAG_SKIP; + task->processed_stages |= RSPAMD_TASK_STAGE_DONE; /* Skip all */ } else if (COMPARE_CMD (p, MSG_CMD_PROCESS, pathlen)) { msg_debug_protocol ("got process -> old check command"); diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c index a484c738b..71b8a4c6a 100644 --- a/src/libserver/rspamd_symcache.c +++ b/src/libserver/rspamd_symcache.c @@ -3124,6 +3124,10 @@ rspamd_symcache_composites_foreach (struct rspamd_task *task, struct rspamd_symcache_item *item; struct rspamd_symcache_dynamic_item *dyn_item; + if (task->checkpoint == NULL) { + return; + } + PTR_ARRAY_FOREACH (cache->composites, i, item) { dyn_item = rspamd_symcache_get_dynamic (task->checkpoint, item); -- 2.39.5