diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-17 16:39:02 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-17 16:39:02 +0100 |
commit | 46b69af3b0dde1b24b518d92668e1073f674efb2 (patch) | |
tree | db26f28a615733bee37c6f686c2630e29f3abf4c /src/plugins | |
parent | ac7cb176fd1eb72a891e4c245d1094c0175a1bad (diff) | |
download | rspamd-46b69af3b0dde1b24b518d92668e1073f674efb2.tar.gz rspamd-46b69af3b0dde1b24b518d92668e1073f674efb2.zip |
[Minor] Moved coroutine-related functionality of DNS resolver into a separated module
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/multimap.lua | 6 | ||||
-rw-r--r-- | src/plugins/lua/reputation.lua | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 4fe69ef88..4514bc4f7 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -28,6 +28,7 @@ local regexp = require "rspamd_regexp" local rspamd_expression = require "rspamd_expression" local rspamd_ip = require "rspamd_ip" local lua_util = require "lua_util" +local rspamd_dns = require "rspamd_dns" local redis_params local fun = require "fun" local N = 'multimap' @@ -703,12 +704,13 @@ local function multimap_callback(task, rule) else local to_resolve = ip_to_rbl(ip, rule['map']) - local is_ok, results = task:get_resolver():resolve_a({ + local is_ok, results = rspamd_dns.request({ + type = "a", task = task, name = to_resolve, }) - lua_util.debugm(N, rspamd_config, 'resolve_a() finished: results=%1, is_ok=%2, to_resolve=%3', results, is_ok, to_resolve) + lua_util.debugm(N, rspamd_config, 'resolve() finished: results=%1, is_ok=%2, to_resolve=%3', results, is_ok, to_resolve) if not is_ok and (results ~= 'requested record is not found' and results ~= 'no records with this name') then rspamd_logger.errx(task, 'error looking up %s: %s', to_resolve, results) diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index f1f9ad916..f5b461d78 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -25,6 +25,7 @@ local N = 'reputation' local rspamd_logger = require "rspamd_logger" local rspamd_util = require "rspamd_util" +local rspamd_dns = require "rspamd_dns" local lua_util = require "lua_util" local lua_maps = require "lua_maps" local hash = require 'rspamd_cryptobox_hash' @@ -716,11 +717,12 @@ end --]] local function reputation_dns_get_token(task, rule, token, continuation_cb) - local r = task:get_resolver() + -- local r = task:get_resolver() local key = gen_token_key(token, rule) local dns_name = key .. '.' .. rule.backend.config.list - local is_ok, results = r:resolve_a({ + local is_ok, results = rspamd_dns.request({ + type = 'a', task = task, name = dns_name, forced = true, |