From: Vsevolod Stakhov Date: Fri, 14 Sep 2018 13:35:54 +0000 (+0100) Subject: [Fix] Deprecate task:inc_dns_req as it is redundant X-Git-Tag: 1.8.0~110 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0d4212eb6cf416c2c02a030195462993bdc84fea;p=rspamd.git [Fix] Deprecate task:inc_dns_req as it is redundant --- diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 868554174..98b05d3a5 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -2344,9 +2344,15 @@ lua_task_inc_dns_req (lua_State *L) { LUA_TRACE_POINT; struct rspamd_task *task = lua_check_task (L, 1); + static guint warning_shown = 0; + + if (warning_shown < 100) { + warning_shown ++; + msg_warn_task_check ("task:inc_dns_req is deprecated and should not be used"); + } if (task != NULL) { - task->dns_requests++; + /* Deprecation: already done in make_dns_request */ } else { return luaL_error (L, "invalid arguments"); diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua index f9c6ecdb6..f2d527a70 100644 --- a/src/plugins/lua/dkim_signing.lua +++ b/src/plugins/lua/dkim_signing.lua @@ -65,7 +65,6 @@ local function dkim_signing_cb(task) task = task, name = resolve_name, callback = function(_, _, results, err) - task:inc_dns_req() if not err and results and results[1] then p.pubkey = results[1] p.strict_pubkey_check = not settings.allow_pubkey_mismatch diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index a06d8ec87..aa6bb18a8 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -246,7 +246,6 @@ local function dmarc_callback(task) local function dmarc_dns_cb(_, to_resolve, results, err) - task:inc_dns_req() local lookup_domain = string.sub(to_resolve, 8) if err and (err ~= 'requested record is not found' and err ~= 'no records with this name') then task:insert_result(dmarc_symbols['dnsfail'], 1.0, lookup_domain .. ' : ' .. err) diff --git a/src/plugins/lua/hfilter.lua b/src/plugins/lua/hfilter.lua index 0659eaa30..70992b8f3 100644 --- a/src/plugins/lua/hfilter.lua +++ b/src/plugins/lua/hfilter.lua @@ -227,7 +227,6 @@ local function check_host(task, host, symbol_suffix, eq_ip, eq_host) local resolved_address = {} local function check_host_cb_mx(_, to_resolve, results, err) - task:inc_dns_req() if err and (err ~= 'requested record is not found' and err ~= 'no records with this name') then lua_util.debugm(N, task, 'error looking up %s: %s', to_resolve, err) end @@ -240,8 +239,6 @@ local function check_host(task, host, symbol_suffix, eq_ip, eq_host) local failed_mx_address = 0 -- Capture failed_mx_address local function check_host_cb_mx_a(_, _, mx_results) - task:inc_dns_req() - if not mx_results then failed_mx_address = failed_mx_address + 1 end @@ -267,8 +264,6 @@ local function check_host(task, host, symbol_suffix, eq_ip, eq_host) end end local function check_host_cb_a(_, _, results) - task:inc_dns_req() - if not results then failed_address = failed_address + 1 else diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 527cf9a62..b09a87dbe 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -50,7 +50,6 @@ local function check_quantity_received (task) rspamd_logger.errx(task, 'error looking up %s: %s', to_resolve, err) task:insert_result(symbol_rdns_dnsfail, 1.0) end - task:inc_dns_req() if not results then if nreceived <= 1 then diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index ac2f8ce33..53f537ac0 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -204,8 +204,6 @@ local function rbl_cb (task) end end end - - task:inc_dns_req() end end diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index 5d3f64b59..6fee1172d 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -754,8 +754,6 @@ local function reputation_dns_get_token(task, rule, token, continuation_cb) else continuation_cb(results, dns_name, nil) end - - task:inc_dns_req() end local function reputation_redis_init(rule, cfg, ev_base, worker)