aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-25 12:50:02 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-25 12:50:02 +0000
commit6af040cf2949ce0eebe52121efef6bb3ce4bcc54 (patch)
tree869ca667a132933cdb3ebff1006986b04bb0a97d /lualib
parent65967cdddf5ff8d858ff070bdc7885482408d2b7 (diff)
downloadrspamd-6af040cf2949ce0eebe52121efef6bb3ce4bcc54.tar.gz
rspamd-6af040cf2949ce0eebe52121efef6bb3ce4bcc54.zip
[Fix] Do not try to connect to non-supported addresses
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_redis.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua
index 7ecb3d424..eda8dc37f 100644
--- a/lualib/lua_redis.lua
+++ b/lualib/lua_redis.lua
@@ -479,10 +479,11 @@ local function rspamd_redis_make_request(task, redis_params, key, is_write, call
end
end
+ local ip_addr = addr:get_addr()
local options = {
task = task,
callback = rspamd_redis_make_request_cb,
- host = addr:get_addr(),
+ host = ip_addr,
timeout = redis_params['timeout'],
cmd = command,
args = args
@@ -497,6 +498,12 @@ local function rspamd_redis_make_request(task, redis_params, key, is_write, call
end
local ret,conn = rspamd_redis.make_request(options)
+
+ if not ret then
+ addr:fail()
+ logger.warnx(task, "cannot make redis request to: %s", tostring(ip_addr))
+ end
+
return ret,conn,addr
end
@@ -550,6 +557,7 @@ local function redis_make_request_taskless(ev_base, cfg, redis_params, key, is_w
local ret,conn = rspamd_redis.make_request(options)
if not ret then
logger.errx('cannot execute redis request')
+ addr:fail()
end
return ret,conn,addr
end