diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-21 13:46:57 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-21 15:04:02 +0100 |
commit | 93d8da4d8519fb54d055873a3f6c317711de8e8f (patch) | |
tree | 323407efc86367b1e81d8259a19e7b71868cb934 /src/lua | |
parent | d145c09388867031cff47e35bca74effd6c25fe8 (diff) | |
download | rspamd-93d8da4d8519fb54d055873a3f6c317711de8e8f.tar.gz rspamd-93d8da4d8519fb54d055873a3f6c317711de8e8f.zip |
Use new dns API.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_http.c | 21 | ||||
-rw-r--r-- | src/lua/lua_tcp.c | 17 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 71cc35f15..427a23827 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -458,12 +458,23 @@ lua_http_request (lua_State *L) } } else { - if (!make_dns_request (resolver, session, NULL, lua_http_dns_handler, cbd, - RDNS_REQUEST_A, msg->host->str)) { - lua_http_maybe_free (cbd); - lua_pushboolean (L, FALSE); + if (task == NULL) { + if (!make_dns_request (resolver, session, NULL, lua_http_dns_handler, cbd, + RDNS_REQUEST_A, msg->host->str)) { + lua_http_maybe_free (cbd); + lua_pushboolean (L, FALSE); - return 1; + return 1; + } + } + else { + if (!make_dns_request_task (task, lua_http_dns_handler, cbd, + RDNS_REQUEST_A, msg->host->str)) { + lua_http_maybe_free (cbd); + lua_pushboolean (L, FALSE); + + return 1; + } } } diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 43e8cab7e..030f3109b 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -610,10 +610,19 @@ lua_tcp_request (lua_State *L) } } else { - if (!make_dns_request (resolver, session, NULL, lua_tcp_dns_handler, cbd, - RDNS_REQUEST_A, host)) { - lua_tcp_push_error (cbd, "cannot resolve host"); - lua_tcp_maybe_free (cbd); + if (task == NULL) { + if (!make_dns_request (resolver, session, NULL, lua_tcp_dns_handler, cbd, + RDNS_REQUEST_A, host)) { + lua_tcp_push_error (cbd, "cannot resolve host"); + lua_tcp_maybe_free (cbd); + } + } + else { + if (!make_dns_request_task (task, lua_tcp_dns_handler, cbd, + RDNS_REQUEST_A, host)) { + lua_tcp_push_error (cbd, "cannot resolve host"); + lua_tcp_maybe_free (cbd); + } } } |