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. */
| 1545 | * If 'announced_ip' length is non-zero, it is used instead of extracting |
| 1546 | * the IP from the socket peer address. */ |
| 1547 | void 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 |
no test coverage detected