Return the node with the specified name (ID) or NULL. */
| 2868 | |
| 2869 | /* Return the node with the specified name (ID) or NULL. */ |
| 2870 | static clusterManagerNode *clusterManagerNodeByName(const char *name) { |
| 2871 | if (cluster_manager.nodes == NULL) return NULL; |
| 2872 | clusterManagerNode *found = NULL; |
| 2873 | sds lcname = sdsempty(); |
| 2874 | lcname = sdscpy(lcname, name); |
| 2875 | sdstolower(lcname); |
| 2876 | listIter li; |
| 2877 | listNode *ln; |
| 2878 | listRewind(cluster_manager.nodes, &li); |
| 2879 | while ((ln = listNext(&li)) != NULL) { |
| 2880 | clusterManagerNode *n = ln->value; |
| 2881 | if (n->name && !sdscmp(n->name, lcname)) { |
| 2882 | found = n; |
| 2883 | break; |
| 2884 | } |
| 2885 | } |
| 2886 | sdsfree(lcname); |
| 2887 | return found; |
| 2888 | } |
| 2889 | |
| 2890 | /* Like clusterManagerNodeByName but the specified name can be just the first |
| 2891 | * part of the node ID as long as the prefix in unique across the |
no test coverage detected