MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nodeIp2String

Function nodeIp2String

app/redis-6.2.6/src/cluster.c:1547–1554  ·  view source on GitHub ↗

IP -> string conversion. 'buf' is supposed to at least be 46 bytes. * If 'announced_ip' length is non-zero, it is used instead of extracting * the IP from the socket peer address. */

Source from the content-addressed store, hash-verified

1545 * If 'announced_ip' length is non-zero, it is used instead of extracting
1546 * the IP from the socket peer address. */
1547void nodeIp2String(char *buf, clusterLink *link, char *announced_ip) {
1548 if (announced_ip[0] != '\0') {
1549 memcpy(buf,announced_ip,NET_IP_STR_LEN);
1550 buf[NET_IP_STR_LEN-1] = '\0'; /* We are not sure the input is sane. */
1551 } else {
1552 connPeerToString(link->conn, buf, NET_IP_STR_LEN, NULL);
1553 }
1554}
1555
1556/* Update the node address to the IP address that can be extracted
1557 * from link->fd, or if hdr->myip is non empty, to the address the node

Callers 2

clusterProcessPacketFunction · 0.85

Calls 2

connPeerToStringFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected