Give clients more accurate names

This commit is contained in:
Pierre Pronchery 2014-04-19 23:15:17 +02:00
parent 0c526125c9
commit 3a7c4e0e28
2 changed files with 7 additions and 2 deletions

View File

@ -440,7 +440,9 @@ static int _tcp_server_add_client(TCP * tcp, TCPSocket * client)
tcp->u.server.clients = p;
/* XXX may not be instant */
if(getnameinfo(client->sa, client->sa_len, host, sizeof(host), NULL, 0,
0) != 0)
NI_NAMEREQD) != 0
&& getnameinfo(client->sa, client->sa_len, host,
sizeof(host), NULL, 0, NI_NUMERICHOST) != 0)
name = NULL;
if((client->client = tcp->helper->client_new(tcp->helper->transport,
name)) == NULL)

View File

@ -403,7 +403,10 @@ static int _udp_client_init(UDPClient * client, struct sockaddr * sa,
return -1;
/* XXX may not be instant */
if(getnameinfo(client->sa, client->sa_len, host, sizeof(host), NULL, 0,
NI_DGRAM) != 0)
NI_NAMEREQD | NI_DGRAM) != 0
&& getnameinfo(client->sa, client->sa_len, host,
sizeof(host), NULL, 0,
NI_NUMERICHOST | NI_DGRAM) != 0)
name = NULL;
if((client->client = helper->client_new(helper->transport, name))
== NULL)