From 3a98d054f54cd3f558dc3596fdde46d7c456d0fc Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 30 Dec 2016 12:49:31 +0000 Subject: [Minor] Add support for unix connections for redis stats backend --- src/libstat/learn_cache/redis_cache.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/libstat/learn_cache/redis_cache.c') 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); -- cgit v1.2.3