Return the node with the specified name (ID) or NULL. */
| 2579 | |
| 2580 | /* Return the node with the specified name (ID) or NULL. */ |
| 2581 | static clusterManagerNode *clusterManagerNodeByName(const char *name) { |
| 2582 | if (cluster_manager.nodes == NULL) return NULL; |
| 2583 | clusterManagerNode *found = NULL; |
| 2584 | sds lcname = sdsempty(); |
| 2585 | lcname = sdscpy(lcname, name); |
| 2586 | sdstolower(lcname); |
| 2587 | listIter li; |
| 2588 | listNode *ln; |
| 2589 | listRewind(cluster_manager.nodes, &li); |
| 2590 | while ((ln = listNext(&li)) != NULL) { |
| 2591 | clusterManagerNode *n = ln->value; |
| 2592 | if (n->name && !sdscmp(n->name, lcname)) { |
| 2593 | found = n; |
| 2594 | break; |
| 2595 | } |
| 2596 | } |
| 2597 | sdsfree(lcname); |
| 2598 | return found; |
| 2599 | } |
| 2600 | |
| 2601 | /* Like clusterManagerNodeByName but the specified name can be just the first |
| 2602 | * part of the node ID as long as the prefix in unique across the |
no test coverage detected