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. */
| 1586 | * If 'announced_ip' length is non-zero, it is used instead of extracting |
| 1587 | * the IP from the socket peer address. */ |
| 1588 | void nodeIp2String(char *buf, clusterLink *link, char *announced_ip) { |
| 1589 | if (announced_ip[0] != '\0') { |
| 1590 | memcpy(buf,announced_ip,NET_IP_STR_LEN); |
| 1591 | buf[NET_IP_STR_LEN-1] = '\0'; /* We are not sure the input is sane. */ |
| 1592 | } else { |
| 1593 | connPeerToString(link->conn, buf, NET_IP_STR_LEN, NULL); |
| 1594 | } |
| 1595 | } |
| 1596 | |
| 1597 | /* Update the node address to the IP address that can be extracted |
| 1598 | * from link->fd, or if hdr->myip is non empty, to the address the node |
no test coverage detected