anetPeerToString() automatically populates ip/port with something that may be provided to the user as output in case of errors.

This commit is contained in:
antirez
2012-03-07 11:30:30 +01:00
parent 9494f1f15b
commit 7b845b6228
2 changed files with 7 additions and 6 deletions

View File

@ -1087,11 +1087,7 @@ sds getClientInfoString(redisClient *client) {
time_t now = time(NULL);
int emask;
if (anetPeerToString(client->fd,ip,&port) == -1) {
ip[0] = '?';
ip[1] = '\0';
port = 0;
}
anetPeerToString(client->fd,ip,&port);
p = flags;
if (client->flags & REDIS_SLAVE) {
if (client->flags & REDIS_MONITOR)