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

Function anetFormatAddr

app/redis-6.2.6/src/anet.c:593–596  ·  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

591 * (matches for ":"), the ip is surrounded by []. IP and port are just
592 * separated by colons. This the standard to display addresses within Redis. */
593int anetFormatAddr(char *buf, size_t buf_len, char *ip, int port) {
594 return snprintf(buf,buf_len, strchr(ip,':') ?
595 "[%s]:%d" : "%s:%d", ip, port);
596}
597
598/* Like anetFormatAddr() but extract ip and port from the socket's peer/sockname. */
599int 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 2

snprintfFunction · 0.85
strchrFunction · 0.85

Tested by

no test coverage detected