Add support for Redis via UNIX domain sockets (#46)

This commit is contained in:
Jakub Vaněk 2017-09-03 14:27:59 +02:00 committed by sfan5
parent 25d1d43004
commit 6afe1b78c5

View File

@ -53,7 +53,7 @@ DBRedis::DBRedis(const std::string &mapdir)
}
const char *addr = tmp.c_str();
int port = stoi64(get_setting_default("redis_port", ifs, "6379"));
ctx = redisConnect(addr, port);
ctx = tmp.find('/') != std::string::npos ? redisConnectUnix(addr) : redisConnect(addr, port);
if(!ctx)
throw std::runtime_error("Cannot allocate redis context");
else if(ctx->err) {