summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2014-02-19 17:30:07 -0500
committerantirez <antirez@gmail.com>2014-03-11 11:09:37 +0100
commita0ea8f235e0ca70cecb87703e283d639a8c179ee (patch)
tree4558601f3e01f82351c44265655a9324a8176b7c
parent6f4b5ef6d53a12aa1cd23854028fab478482d8ac (diff)
downloadredis-a0ea8f235e0ca70cecb87703e283d639a8c179ee.tar.gz
Cluster: error out quicker if port is unusable
The default cluster control port is 10,000 ports higher than the base Redis port. If Redis is started on a too-high port, Cluster can't start and everything will exit later anyway.
-rw-r--r--src/cluster.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cluster.c b/src/cluster.c
index afea589ec..15afd8e54 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -329,6 +329,19 @@ void clusterInit(void) {
/* We need a listening TCP port for our cluster messaging needs. */
server.cfd_count = 0;
+
+ /* Port sanity check II
+ The other handshake port check is triggered too late to stop
+ us from trying to use a too-high cluster port number.
+ */
+ if (server.port > (65535-REDIS_CLUSTER_PORT_INCR)) {
+ redisLog(REDIS_WARNING, "Redis port number too high. "
+ "Cluster communication port is 10,000 port "
+ "numbers higher than your Redis port. "
+ "Your Redis port number must be "
+ "lower than 55535.");
+ }
+
if (listenToPort(server.port+REDIS_CLUSTER_PORT_INCR,
server.cfd,&server.cfd_count) == REDIS_ERR)
{