diff options
author | Travis Burtrum <android@moparisthebest.org> | 2017-02-06 13:10:03 -0500 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-02-06 19:10:03 +0100 |
commit | 5da3ed19a38ba5a342ba16c61be7bfb7c17b2308 (patch) | |
tree | cc0acfce83c976f61bb90a4e320f92fd0c73f848 | |
parent | 3e30731c1ac313b504ff15eb7f40ce6a387d3da2 (diff) | |
download | minetest-5da3ed19a38ba5a342ba16c61be7bfb7c17b2308.tar.gz minetest-5da3ed19a38ba5a342ba16c61be7bfb7c17b2308.tar.bz2 minetest-5da3ed19a38ba5a342ba16c61be7bfb7c17b2308.zip |
Add support for unix socket connection to redis (#5179)
-rw-r--r-- | src/database-redis.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/database-redis.cpp b/src/database-redis.cpp index 3bcedad9b..3df186944 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); + // if redis_address contains '/' assume unix socket, else hostname/ip + ctx = tmp.find('/') != std::string::npos ? redisConnectUnix(addr) : redisConnect(addr, port); if (!ctx) { throw DatabaseException("Cannot allocate redis context"); } else if (ctx->err) { |