MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / parseClusterNodeAddress

Function parseClusterNodeAddress

src/redis-cli.c:2343–2359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2341}
2342
2343int parseClusterNodeAddress(char *addr, char **ip_ptr, int *port_ptr,
2344 int *bus_port_ptr)
2345{
2346 char *c = strrchr(addr, '@');
2347 if (c != NULL) {
2348 *c = '\0';
2349 if (bus_port_ptr != NULL)
2350 *bus_port_ptr = atoi(c + 1);
2351 }
2352 c = strrchr(addr, ':');
2353 if (c != NULL) {
2354 *c = '\0';
2355 *ip_ptr = addr;
2356 *port_ptr = atoi(++c);
2357 } else return 0;
2358 return 1;
2359}
2360
2361/* Get host ip and port from command arguments. If only one argument has
2362 * been provided it must be in the form of 'ip:port', elsewhere

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected