Commit 89381980 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Remove disabling TCP with port -1

parent 5d10923f
...@@ -21,7 +21,6 @@ daemonize no ...@@ -21,7 +21,6 @@ daemonize no
pidfile /var/run/redis.pid pidfile /var/run/redis.pid
# Accept connections on the specified port, default is 6379. # Accept connections on the specified port, default is 6379.
# Use port -1 to disable listening on a network interface.
port 6379 port 6379
# If you want you can bind a single interface, if the bind option is not # If you want you can bind a single interface, if the bind option is not
......
...@@ -66,9 +66,7 @@ void loadServerConfig(char *filename) { ...@@ -66,9 +66,7 @@ void loadServerConfig(char *filename) {
} }
} else if (!strcasecmp(argv[0],"port") && argc == 2) { } else if (!strcasecmp(argv[0],"port") && argc == 2) {
server.port = atoi(argv[1]); server.port = atoi(argv[1]);
if (server.port != -1 && if (server.port < 1 || server.port > 65535) {
(server.port < 1 || server.port > 65535))
{
err = "Invalid port"; goto loaderr; err = "Invalid port"; goto loaderr;
} }
} else if (!strcasecmp(argv[0],"bind") && argc == 2) { } else if (!strcasecmp(argv[0],"bind") && argc == 2) {
......
...@@ -776,12 +776,10 @@ void initServer() { ...@@ -776,12 +776,10 @@ void initServer() {
createSharedObjects(); createSharedObjects();
server.el = aeCreateEventLoop(); server.el = aeCreateEventLoop();
server.db = zmalloc(sizeof(redisDb)*server.dbnum); server.db = zmalloc(sizeof(redisDb)*server.dbnum);
if (server.port > 0) { server.ipfd = anetTcpServer(server.neterr,server.port,server.bindaddr);
server.ipfd = anetTcpServer(server.neterr,server.port,server.bindaddr); if (server.ipfd == ANET_ERR) {
if (server.ipfd == ANET_ERR) { redisLog(REDIS_WARNING, "Opening port: %s", server.neterr);
redisLog(REDIS_WARNING, "Opening port: %s", server.neterr); exit(1);
exit(1);
}
} }
if (server.unixsocket != NULL) { if (server.unixsocket != NULL) {
unlink(server.unixsocket); /* don't care if this fails */ unlink(server.unixsocket); /* don't care if this fails */
......
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