diff options
-rw-r--r-- | src/lua/lua_task.c | 3 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/plugins/surbl.c | 1 | ||||
-rw-r--r-- | src/protocol.c | 9 | ||||
-rw-r--r-- | src/spf.c | 8 |
5 files changed, 19 insertions, 4 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 339f9e23f..a0e6a3992 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -571,6 +571,7 @@ lua_task_resolve_dns_a (lua_State * L) return 0; } if (make_dns_request (task->resolver, task->s, task->task_pool, lua_dns_callback, (void *)cd, DNS_REQUEST_A, cd->to_resolve)) { + task->dns_requests ++; task->save.saved++; } } @@ -612,6 +613,7 @@ lua_task_resolve_dns_txt (lua_State * L) return 0; } if (make_dns_request (task->resolver, task->s, task->task_pool, lua_dns_callback, (void *)cd, DNS_REQUEST_TXT, cd->to_resolve)) { + task->dns_requests ++; task->save.saved++; } } @@ -655,6 +657,7 @@ lua_task_resolve_dns_ptr (lua_State * L) return 0; } if (make_dns_request (task->resolver, task->s, task->task_pool, lua_dns_callback, (void *)cd, DNS_REQUEST_PTR, ina)) { + task->dns_requests ++; task->save.saved++; } } diff --git a/src/main.h b/src/main.h index e6cf67078..02bebf89a 100644 --- a/src/main.h +++ b/src/main.h @@ -229,6 +229,8 @@ struct worker_task { gboolean (*fin_callback)(void *arg); /**< calback for filters finalizing */ void *fin_arg; /**< argument for fin callback */ + guint32 dns_requests; /**< number of DNS requests per this task */ + struct rspamd_dns_resolver *resolver; /**< DNS resolver */ }; diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index d3763822c..6266e61eb 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -605,6 +605,7 @@ make_surbl_requests (struct uri *url, struct worker_task *task, param->host_resolve = memory_pool_strdup (task->task_pool, surbl_req); debug_task ("send surbl dns request %s", surbl_req); if (make_dns_request (task->resolver, task->s, task->task_pool, dns_callback, (void *)param, DNS_REQUEST_A, surbl_req)) { + task->dns_requests ++; param->task->save.saved++; } } diff --git a/src/protocol.c b/src/protocol.c index f6b0c30fc..edeec92b9 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -821,12 +821,13 @@ show_metric_result (gpointer metric_name, gpointer metric_value, void *user_data } #ifdef HAVE_CLOCK_GETTIME cd->log_offset += rspamd_snprintf (cd->log_buf + cd->log_offset, - cd->log_size - cd->log_offset, "]), len: %z, time: %s,", + cd->log_size - cd->log_offset, "]), len: %z, time: %s, dns req: %d,", task->msg->len, calculate_check_time (&task->tv, &task->ts, - task->cfg->clock_res)); + task->cfg->clock_res), task->dns_requests); #else - cd->log_offset += rspamd_snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "]), len: %z, time: %s,", - task->msg->len, calculate_check_time (&task->tv, task->cfg->clock_res)); + cd->log_offset += rspamd_snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, + "]), len: %z, time: %s, dns req: %d,", + task->msg->len, calculate_check_time (&task->tv, task->cfg->clock_res), task->dns_requests); #endif } @@ -340,6 +340,7 @@ spf_record_dns_callback (struct rspamd_dns_reply *reply, gpointer arg) if (reply->type == DNS_REQUEST_MX) { /* Now resolve A record for this MX */ if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, elt_data->mx.name)) { + task->dns_requests ++; task->save.saved++; } } @@ -492,6 +493,7 @@ parse_spf_a (struct worker_task *task, const gchar *begin, struct spf_record *re cb->cur_action = SPF_RESOLVE_A; cb->in_include = rec->in_include; if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) { + task->dns_requests ++; task->save.saved++; return TRUE; @@ -539,6 +541,7 @@ parse_spf_mx (struct worker_task *task, const gchar *begin, struct spf_record *r cb->cur_action = SPF_RESOLVE_MX; cb->in_include = rec->in_include; if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_MX, host)) { + task->dns_requests ++; task->save.saved++; return TRUE; @@ -596,6 +599,7 @@ parse_spf_include (struct worker_task *task, const gchar *begin, struct spf_reco addr->data.list = NULL; domain = memory_pool_strdup (task->task_pool, begin); if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) { + task->dns_requests ++; task->save.saved++; return TRUE; @@ -635,6 +639,7 @@ parse_spf_redirect (struct worker_task *task, const gchar *begin, struct spf_rec cb->in_include = rec->in_include; domain = memory_pool_strdup (task->task_pool, begin); if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) { + task->dns_requests ++; task->save.saved++; return TRUE; @@ -666,6 +671,7 @@ parse_spf_exists (struct worker_task *task, const gchar *begin, struct spf_recor host = memory_pool_strdup (task->task_pool, begin); if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) { + task->dns_requests ++; task->save.saved++; return TRUE; @@ -1195,6 +1201,7 @@ resolve_spf (struct worker_task *task, spf_cb_t callback) rec->sender_domain = rec->cur_domain; if (make_dns_request (task->resolver, task->s, task->task_pool, spf_dns_callback, (void *)rec, DNS_REQUEST_TXT, rec->cur_domain)) { + task->dns_requests ++; task->save.saved++; return TRUE; } @@ -1224,6 +1231,7 @@ resolve_spf (struct worker_task *task, spf_cb_t callback) } rec->sender_domain = rec->cur_domain; if (make_dns_request (task->resolver, task->s, task->task_pool, spf_dns_callback, (void *)rec, DNS_REQUEST_TXT, rec->cur_domain)) { + task->dns_requests ++; task->save.saved++; return TRUE; } |