aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-13 13:28:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-13 13:28:58 +0100
commit8adb4632a9869704776fccb4e40a48ef140f0be4 (patch)
tree4b1b4a594611b4bca21dc7c0e6e6231cd6e8e37f
parent2d2ed1bc750469e308fdf38f31964e905f6eb932 (diff)
downloadrspamd-8adb4632a9869704776fccb4e40a48ef140f0be4.tar.gz
rspamd-8adb4632a9869704776fccb4e40a48ef140f0be4.zip
[Minor] Another fix to lua_tcp watchers
-rw-r--r--src/lua/lua_tcp.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index ef4b4cb5a..b5b6eba5f 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -1655,12 +1655,9 @@ lua_tcp_request (lua_State *L)
rspamd_inet_address_set_port (cbd->addr, port);
/* Host is numeric IP, no need to resolve */
if (!lua_tcp_make_connection (cbd)) {
- TCP_RELEASE (cbd);
lua_pushboolean (L, FALSE);
- if (cbd->w) {
- rspamd_session_watcher_pop (cbd->session, cbd->w);
- }
+ TCP_RELEASE (cbd);
return 1;
}
@@ -1670,12 +1667,9 @@ lua_tcp_request (lua_State *L)
if (!make_dns_request (resolver, session, NULL, lua_tcp_dns_handler, cbd,
RDNS_REQUEST_A, host)) {
lua_tcp_push_error (cbd, TRUE, "cannot resolve host: %s", host);
- TCP_RELEASE (cbd);
lua_pushboolean (L, FALSE);
- if (cbd->w) {
- rspamd_session_watcher_pop (cbd->session, cbd->w);
- }
+ TCP_RELEASE (cbd);
return 1;
}
@@ -1684,12 +1678,9 @@ lua_tcp_request (lua_State *L)
if (!make_dns_request_task (task, lua_tcp_dns_handler, cbd,
RDNS_REQUEST_A, host)) {
lua_tcp_push_error (cbd, TRUE, "cannot resolve host: %s", host);
- TCP_RELEASE (cbd);
lua_pushboolean (L, FALSE);
- if (cbd->w) {
- rspamd_session_watcher_pop (cbd->session, cbd->w);
- }
+ TCP_RELEASE (cbd);
return 1;
}
@@ -1827,13 +1818,10 @@ lua_tcp_connect_sync (lua_State *L)
rspamd_inet_address_set_port (cbd->addr, (guint16)port);
/* Host is numeric IP, no need to resolve */
if (!lua_tcp_make_connection (cbd)) {
- TCP_RELEASE (cbd);
lua_pushboolean (L, FALSE);
lua_pushliteral (L, "Failed to initiate connection");
- if (cbd->w) {
- rspamd_session_watcher_pop (cbd->session, cbd->w);
- }
+ TCP_RELEASE (cbd);
return 2;
}
@@ -1842,13 +1830,10 @@ lua_tcp_connect_sync (lua_State *L)
if (task == NULL) {
if (!make_dns_request (resolver, session, NULL, lua_tcp_dns_handler, cbd,
RDNS_REQUEST_A, host)) {
- TCP_RELEASE (cbd);
lua_pushboolean (L, FALSE);
lua_pushliteral (L, "Failed to initiate dns request");
- if (cbd->w) {
- rspamd_session_watcher_pop (cbd->session, cbd->w);
- }
+ TCP_RELEASE (cbd);
return 2;
}
@@ -1856,13 +1841,9 @@ lua_tcp_connect_sync (lua_State *L)
else {
if (!make_dns_request_task (task, lua_tcp_dns_handler, cbd,
RDNS_REQUEST_A, host)) {
- TCP_RELEASE (cbd);
lua_pushboolean (L, FALSE);
lua_pushliteral (L, "Failed to initiate dns request");
-
- if (cbd->w) {
- rspamd_session_watcher_pop (cbd->session, cbd->w);
- }
+ TCP_RELEASE (cbd);
return 2;
}