Commit a36d5245 authored by antirez's avatar antirez
Browse files

If port zero is specified, Redis will not listen for TCP connections

parent 71791e7a
......@@ -21,6 +21,7 @@ daemonize no
pidfile /var/run/redis.pid
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
# If you want you can bind a single interface, if the bind option is not
......
......@@ -852,7 +852,10 @@ void initServer() {
createSharedObjects();
server.el = aeCreateEventLoop();
server.db = zmalloc(sizeof(redisDb)*server.dbnum);
server.ipfd = anetTcpServer(server.neterr,server.port,server.bindaddr);
if (server.port != 0)
server.ipfd = anetTcpServer(server.neterr,server.port,server.bindaddr);
if (server.ipfd == ANET_ERR) {
redisLog(REDIS_WARNING, "Opening port: %s", server.neterr);
exit(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment