summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/networking.c b/src/networking.c
index 6bf39d11a..04ba54768 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -1196,7 +1196,7 @@ int islocalClient(client *c) {
/* tcp */
char cip[NET_IP_STR_LEN+1] = { 0 };
- connPeerToString(c->conn, cip, sizeof(cip)-1, NULL);
+ connAddrPeerName(c->conn, cip, sizeof(cip)-1, NULL);
return !strcmp(cip,"127.0.0.1") || !strcmp(cip,"::1");
}
@@ -2700,13 +2700,13 @@ done:
* you want to relax error checking or need to display something anyway (see
* anetFdToString implementation for more info). */
void genClientAddrString(client *client, char *addr,
- size_t addr_len, int fd_to_str_type) {
+ size_t addr_len, int remote) {
if (client->flags & CLIENT_UNIX_SOCKET) {
/* Unix socket client. */
snprintf(addr,addr_len,"%s:0",server.unixsocket);
} else {
/* TCP client. */
- connFormatFdAddr(client->conn,addr,addr_len,fd_to_str_type);
+ connFormatAddr(client->conn,addr,addr_len,remote);
}
}
@@ -2715,10 +2715,10 @@ void genClientAddrString(client *client, char *addr,
* The Peer ID never changes during the life of the client, however it
* is expensive to compute. */
char *getClientPeerId(client *c) {
- char peerid[NET_ADDR_STR_LEN];
+ char peerid[NET_ADDR_STR_LEN] = {0};
if (c->peerid == NULL) {
- genClientAddrString(c,peerid,sizeof(peerid),FD_TO_PEER_NAME);
+ genClientAddrString(c,peerid,sizeof(peerid),1);
c->peerid = sdsnew(peerid);
}
return c->peerid;
@@ -2729,10 +2729,10 @@ char *getClientPeerId(client *c) {
* The Socket Name never changes during the life of the client, however it
* is expensive to compute. */
char *getClientSockname(client *c) {
- char sockname[NET_ADDR_STR_LEN];
+ char sockname[NET_ADDR_STR_LEN] = {0};
if (c->sockname == NULL) {
- genClientAddrString(c,sockname,sizeof(sockname),FD_TO_SOCK_NAME);
+ genClientAddrString(c,sockname,sizeof(sockname),0);
c->sockname = sdsnew(sockname);
}
return c->sockname;