diff --git a/hiredis/async.h b/hiredis/async.h index 2ef0e21..3ebea4e 100644 --- a/hiredis/async.h +++ b/hiredis/async.h @@ -90,6 +90,7 @@ typedef struct redisAsyncContext { /* Functions that proxy to hiredis */ redisAsyncContext *redisAsyncConnect(const char *ip, int port); +redisAsyncContext *redisAsyncConnectUnix(const char *path); int redisAsyncSetReplyObjectFunctions(redisAsyncContext *ac, redisReplyObjectFunctions *fn); int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn); int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn); diff --git a/turnip.c b/turnip.c index 82f6fdc..c8a90c8 100644 --- a/turnip.c +++ b/turnip.c @@ -69,7 +69,12 @@ main(int argc, char *argv[]) { signal(SIGPIPE, SIG_IGN); #endif - redisAsyncContext *c = redisAsyncConnect(cfg->redis_host, cfg->redis_port); + redisAsyncContext *c = NULL; + if(cfg->redis_host[0] == '/') { /* unix socket */ + c = redisAsyncConnectUnix(cfg->redis_host); + } else { + c = redisAsyncConnect(cfg->redis_host, cfg->redis_port); + } if(c->err) { /* Let *c leak for now... */ printf("Error: %s\n", c->errstr);