redis: add support for unix socket

If there is a '/' in the redis server string then we consider that
the connection should be done other a unix socket.
pull/5047/head
Eric Leblond 6 years ago committed by Victor Julien
parent 82fb72678f
commit 025de61f43

@ -201,7 +201,11 @@ static int SCConfLogReopenAsyncRedis(LogFileCtx *log_ctx)
return -1;
}
ctx->async = redisAsyncConnect(redis_server, redis_port);
if (strchr(redis_server, '/') == NULL) {
ctx->async = redisAsyncConnect(redis_server, redis_port);
} else {
ctx->async = redisAsyncConnectUnix(redis_server);
}
if (ctx->ev_base != NULL) {
event_base_free(ctx->ev_base);
@ -295,7 +299,12 @@ static int SCConfLogReopenSyncRedis(LogFileCtx *log_ctx)
if (ctx->sync != NULL) {
redisFree(ctx->sync);
}
ctx->sync = redisConnect(redis_server, redis_port);
if (strchr(redis_server, '/') == NULL) {
ctx->sync = redisConnect(redis_server, redis_port);
} else {
ctx->sync = redisConnectUnix(redis_server);
}
if (ctx->sync == NULL) {
SCLogError(SC_ERR_SOCKET, "Error connecting to redis server.");
ctx->tried = time(NULL);

Loading…
Cancel
Save