Cluster: clusterAddSlot() was not doing what stated in the comment.

This commit is contained in:
antirez 2013-02-21 11:51:17 +01:00
parent fdb57233e2
commit dc4af60628

View File

@ -1135,8 +1135,8 @@ int clusterNodeGetSlotBit(clusterNode *n, int slot) {
* If the slot is already assigned to another instance this is considered * If the slot is already assigned to another instance this is considered
* an error and REDIS_ERR is returned. */ * an error and REDIS_ERR is returned. */
int clusterAddSlot(clusterNode *n, int slot) { int clusterAddSlot(clusterNode *n, int slot) {
if (clusterNodeSetSlotBit(n,slot) != 0) if (server.cluster->slots[slot]) return REDIS_ERR;
return REDIS_ERR; clusterNodeSetSlotBit(n,slot);
server.cluster->slots[slot] = n; server.cluster->slots[slot] = n;
return REDIS_OK; return REDIS_OK;
} }