Format an IP,port pair into something easy to parse. If IP is IPv6 * (matches for ":"), the ip is surrounded by []. IP and port are just * separated by colons. This the standard to display addresses within Redis. */
| 600 | * (matches for ":"), the ip is surrounded by []. IP and port are just |
| 601 | * separated by colons. This the standard to display addresses within Redis. */ |
| 602 | int anetFormatAddr(char *buf, size_t buf_len, char *ip, int port) { |
| 603 | return snprintf(buf,buf_len, strchr(ip,':') ? |
| 604 | "[%s]:%d" : "%s:%d", ip, port); |
| 605 | } |
| 606 | |
| 607 | /* Like anetFormatAddr() but extract ip and port from the socket's peer/sockname. */ |
| 608 | int anetFormatFdAddr(int fd, char *buf, size_t buf_len, int fd_to_str_type) { |
no outgoing calls
no test coverage detected