From dc4af6062897abb8b2b4dc8c754e64a640992ce0 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 21 Feb 2013 11:51:17 +0100 Subject: [PATCH] Cluster: clusterAddSlot() was not doing what stated in the comment. --- src/cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index a872cc51..6959a236 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1135,8 +1135,8 @@ int clusterNodeGetSlotBit(clusterNode *n, int slot) { * If the slot is already assigned to another instance this is considered * an error and REDIS_ERR is returned. */ int clusterAddSlot(clusterNode *n, int slot) { - if (clusterNodeSetSlotBit(n,slot) != 0) - return REDIS_ERR; + if (server.cluster->slots[slot]) return REDIS_ERR; + clusterNodeSetSlotBit(n,slot); server.cluster->slots[slot] = n; return REDIS_OK; }