Cleanup the blacklist and add a new node ID to the black list. */
| 1267 | |
| 1268 | /* Cleanup the blacklist and add a new node ID to the black list. */ |
| 1269 | void clusterBlacklistAddNode(clusterNode *node) { |
| 1270 | dictEntry *de; |
| 1271 | sds id = sdsnewlen(node->name,CLUSTER_NAMELEN); |
| 1272 | |
| 1273 | clusterBlacklistCleanup(); |
| 1274 | if (dictAdd(g_pserver->cluster->nodes_black_list,id,NULL) == DICT_OK) { |
| 1275 | /* If the key was added, duplicate the sds string representation of |
| 1276 | * the key for the next lookup. We'll free it at the end. */ |
| 1277 | id = sdsdup(id); |
| 1278 | } |
| 1279 | de = dictFind(g_pserver->cluster->nodes_black_list,id); |
| 1280 | dictSetUnsignedIntegerVal(de,time(NULL)+CLUSTER_BLACKLIST_TTL); |
| 1281 | sdsfree(id); |
| 1282 | } |
| 1283 | |
| 1284 | /* Return non-zero if the specified node ID exists in the blacklist. |
| 1285 | * You don't need to pass an sds string here, any pointer to 40 bytes |
no test coverage detected