Skip to content
Permalink
Browse files

Add support for unix socket connection to redis (#5179)

  • Loading branch information...
moparisthebest authored and nerzhul committed Feb 6, 2017
1 parent 3e30731 commit 5da3ed19a38ba5a342ba16c61be7bfb7c17b2308
Showing with 2 additions and 1 deletion.
  1. +2 −1 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) {

0 comments on commit 5da3ed1

Please sign in to comment.
You can’t perform that action at this time.