diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-23 17:20:22 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-23 17:20:22 +0100 |
commit | 8303b194152ffc02b5079b6bd08f1fecfd43f5d0 (patch) | |
tree | 827d8d0e421a5515a3d0d83e320734617eec288f | |
parent | 2fb5e8d97d95f53cee6f9719c34ee3081769b4e5 (diff) | |
download | rspamd-8303b194152ffc02b5079b6bd08f1fecfd43f5d0.tar.gz rspamd-8303b194152ffc02b5079b6bd08f1fecfd43f5d0.zip |
[Fix] Lua_tcp: Report connection failures
Issue: #2899
-rw-r--r-- | src/lua/lua_tcp.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index ccc4d59a1..1c789a9d3 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -1550,17 +1550,12 @@ lua_tcp_request (lua_State *L) lua_pop (L, 1); } else { - msg_err ("tcp request has bad params"); - lua_pushboolean (L, FALSE); - - return 1; + return luaL_error (L, "tcp request has bad params"); } if (resolver == NULL && cfg == NULL && task == NULL) { - msg_err ("tcp request has bad params: one of {resolver,task,config} should be set"); - lua_pushboolean (L, FALSE); - - return 1; + return luaL_error (L, "tcp request has bad params: one of " + "{resolver,task,config} should be set"); } cbd->task = task; @@ -1637,6 +1632,7 @@ lua_tcp_request (lua_State *L) cbd->session = session; if (rspamd_session_blocked (session)) { + lua_tcp_push_error (cbd, TRUE, "async session is the blocked state"); TCP_RELEASE (cbd); lua_pushboolean (L, FALSE); @@ -1650,6 +1646,7 @@ lua_tcp_request (lua_State *L) lua_tcp_register_watcher (cbd); if (!lua_tcp_make_connection (cbd)) { + lua_tcp_push_error (cbd, TRUE, "cannot connect to the host: %s", host); lua_pushboolean (L, FALSE); TCP_RELEASE (cbd); |