Rename variable sockpath to unixsocket

This commit is contained in:
Pieter Noordhuis 2010-10-13 17:17:56 +02:00
parent 704bd093be
commit 5d10923f7b
4 changed files with 12 additions and 11 deletions

View File

@ -29,10 +29,11 @@ port 6379
#
# bind 127.0.0.1
# Specify the path for the domain socket that will be used to listen for
# incoming connections. If not specified, Redis will not use a domain socket.
# Specify the path for the unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
# socket /tmp/redis.sock
# unixsocket /tmp/redis.sock
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 300

View File

@ -73,8 +73,8 @@ void loadServerConfig(char *filename) {
}
} else if (!strcasecmp(argv[0],"bind") && argc == 2) {
server.bindaddr = zstrdup(argv[1]);
} else if (!strcasecmp(argv[0],"socket") && argc == 2) {
server.sockpath = zstrdup(argv[1]);
} else if (!strcasecmp(argv[0],"unixsocket") && argc == 2) {
server.unixsocket = zstrdup(argv[1]);
} else if (!strcasecmp(argv[0],"save") && argc == 3) {
int seconds = atoi(argv[1]);
int changes = atoi(argv[2]);

View File

@ -698,7 +698,7 @@ void createSharedObjects(void) {
void initServerConfig() {
server.port = REDIS_SERVERPORT;
server.bindaddr = NULL;
server.sockpath = NULL;
server.unixsocket = NULL;
server.ipfd = -1;
server.sofd = -1;
server.dbnum = REDIS_DEFAULT_DBNUM;
@ -783,9 +783,9 @@ void initServer() {
exit(1);
}
}
if (server.sockpath != NULL) {
unlink(server.sockpath); /* don't care if this fails */
server.sofd = anetUnixServer(server.neterr,server.sockpath);
if (server.unixsocket != NULL) {
unlink(server.unixsocket); /* don't care if this fails */
server.sofd = anetUnixServer(server.neterr,server.unixsocket);
if (server.sofd == ANET_ERR) {
redisLog(REDIS_WARNING, "Opening socket: %s", server.neterr);
exit(1);
@ -1438,7 +1438,7 @@ int main(int argc, char **argv) {
if (server.ipfd > 0)
redisLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port);
if (server.sofd > 0)
redisLog(REDIS_NOTICE,"The server is now ready to accept connections at %s", server.sockpath);
redisLog(REDIS_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
aeSetBeforeSleepProc(server.el,beforeSleep);
aeMain(server.el);
aeDeleteEventLoop(server.el);

View File

@ -330,7 +330,7 @@ struct redisServer {
pthread_t mainthread;
int port;
char *bindaddr;
char *sockpath;
char *unixsocket;
int ipfd;
int sofd;
redisDb *db;