1
0
mirror of https://github.com/fluencelabs/redis synced 2025-04-07 18:08:04 +00:00

anetPeerToString(): make unix sockets distinguishable.

Following the CLIENT LIST output format, we prefix the unix socket
address with a "/" so that it is different than an IPv4/6 address.
This makes parsing simpler.

Related to .
This commit is contained in:
antirez 2014-09-18 17:37:05 +02:00
parent 6d53b2f34b
commit 747b57cfb6

@ -541,7 +541,7 @@ int anetPeerToString(int fd, char *ip, size_t ip_len, int *port) {
if (ip) inet_ntop(AF_INET6,(void*)&(s->sin6_addr),ip,ip_len); if (ip) inet_ntop(AF_INET6,(void*)&(s->sin6_addr),ip,ip_len);
if (port) *port = ntohs(s->sin6_port); if (port) *port = ntohs(s->sin6_port);
} else if (sa.ss_family == AF_UNIX) { } else if (sa.ss_family == AF_UNIX) {
if (ip) strncpy(ip,"unixsocket",ip_len); if (ip) strncpy(ip,"/unixsocket",ip_len);
if (port) *port = 0; if (port) *port = 0;
} else { } else {
goto error; goto error;