Commit 4e186115 authored by antirez's avatar antirez
Browse files

Cluster: clusterBlacklistAddNode() key lookup fixed.

We can't lookup by node->name that's not an SDS string but a plain C
array in the node structure.
parent b51be7b3
...@@ -708,10 +708,14 @@ void clusterBlacklistAddNode(clusterNode *node) { ...@@ -708,10 +708,14 @@ void clusterBlacklistAddNode(clusterNode *node) {
sds id = sdsnewlen(node->name,REDIS_CLUSTER_NAMELEN); sds id = sdsnewlen(node->name,REDIS_CLUSTER_NAMELEN);
clusterBlacklistCleanup(); clusterBlacklistCleanup();
if (dictAdd(server.cluster->nodes_black_list,id,NULL) == DICT_ERR) if (dictAdd(server.cluster->nodes_black_list,id,NULL) == DICT_OK) {
sdsfree(id); /* Key was already there. */ /* If the key was added, duplicate the sds string representation of
de = dictFind(server.cluster->nodes_black_list,node->name); * the key for the next lookup. We'll free it at the end. */
id = sdsdup(id);
}
de = dictFind(server.cluster->nodes_black_list,id);
dictSetUnsignedIntegerVal(de,time(NULL)); dictSetUnsignedIntegerVal(de,time(NULL));
sdsfree(id);
} }
/* Return non-zero if the specified node ID exists in the blacklist. /* Return non-zero if the specified node ID exists in the blacklist.
......
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