aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/learn_cache/redis_cache.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-30 12:49:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-30 12:49:31 +0000
commit3a98d054f54cd3f558dc3596fdde46d7c456d0fc (patch)
tree0bd8a31e2bf05fc3f009643ea3d85276f112a749 /src/libstat/learn_cache/redis_cache.c
parent3e8d0156b8549c38be5c934686c86e9133420e3a (diff)
downloadrspamd-3a98d054f54cd3f558dc3596fdde46d7c456d0fc.tar.gz
rspamd-3a98d054f54cd3f558dc3596fdde46d7c456d0fc.zip
[Minor] Add support for unix connections for redis stats backend
Diffstat (limited to 'src/libstat/learn_cache/redis_cache.c')
-rw-r--r--src/libstat/learn_cache/redis_cache.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c
index 21f35a563..cc6e66469 100644
--- a/src/libstat/learn_cache/redis_cache.c
+++ b/src/libstat/learn_cache/redis_cache.c
@@ -398,8 +398,15 @@ rspamd_stat_cache_redis_runtime (struct rspamd_task *task,
addr = rspamd_upstream_addr (up);
g_assert (addr != NULL);
- rt->redis = redisAsyncConnect (rspamd_inet_address_to_string (addr),
- rspamd_inet_address_get_port (addr));
+
+ if (rspamd_inet_address_get_af (addr) == AF_UNIX) {
+ rt->redis = redisAsyncConnectUnix (rspamd_inet_address_to_string (addr));
+ }
+ else {
+ rt->redis = redisAsyncConnect (rspamd_inet_address_to_string (addr),
+ rspamd_inet_address_get_port (addr));
+ }
+
g_assert (rt->redis != NULL);
redisLibeventAttach (rt->redis, task->ev_base);