A Redis "Address String" is a colon separated ip:port pair. * For IPv4 it's in the form x.y.z.k:port, example: "127.0.0.1:1234". * For IPv6 addresses we use [] around the IP part, like in "[::1]:1234". * For Unix sockets we use path:0, like in "/tmp/redis:0". * * An Address String always fits inside a buffer of NET_ADDR_STR_LEN bytes, * including the null term. * * On failure the function
| 2256 | * you want to relax error checking or need to display something anyway (see |
| 2257 | * anetFdToString implementation for more info). */ |
| 2258 | void genClientAddrString(client *client, char *addr, |
| 2259 | size_t addr_len, int fd_to_str_type) { |
| 2260 | if (client->flags & CLIENT_UNIX_SOCKET) { |
| 2261 | /* Unix socket client. */ |
| 2262 | snprintf(addr,addr_len,"%s:0",server.unixsocket); |
| 2263 | } else { |
| 2264 | /* TCP client. */ |
| 2265 | connFormatFdAddr(client->conn,addr,addr_len,fd_to_str_type); |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | /* This function returns the client peer id, by creating and caching it |
| 2270 | * if client->peerid is NULL, otherwise returning the cached value. |
no test coverage detected