27 lines
917 B
Diff
27 lines
917 B
Diff
From 6ed67ee56d0d2d5a0ab58b99eacde018025cd605 Mon Sep 17 00:00:00 2001
|
|
From: moparisthebest <admin@moparisthebest.com>
|
|
Date: Sun, 5 Feb 2017 00:26:07 -0500
|
|
Subject: [PATCH] Add support for unix socket connection to redis
|
|
|
|
---
|
|
src/database-redis.cpp | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/database-redis.cpp b/src/database-redis.cpp
|
|
index 3bcedad9..ed94de63 100644
|
|
--- a/src/database-redis.cpp
|
|
+++ b/src/database-redis.cpp
|
|
@@ -44,7 +44,8 @@ Database_Redis::Database_Redis(Settings &conf)
|
|
}
|
|
const char *addr = tmp.c_str();
|
|
int port = conf.exists("redis_port") ? conf.getU16("redis_port") : 6379;
|
|
- ctx = redisConnect(addr, port);
|
|
+ std::size_t unixSocket = tmp.find('/');
|
|
+ ctx = unixSocket != std::string::npos ? redisConnectUnix(addr) : redisConnect(addr, port);
|
|
if (!ctx) {
|
|
throw DatabaseException("Cannot allocate redis context");
|
|
} else if (ctx->err) {
|
|
--
|
|
2.11.1
|
|
|