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

Function anetFormatAddr

src/anet.c:602–605  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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. */
602int 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. */
608int anetFormatFdAddr(int fd, char *buf, size_t buf_len, int fd_to_str_type) {

Callers 3

cliRefreshPromptFunction · 0.85
replicationGetSlaveNameFunction · 0.85
anetFormatFdAddrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected