Merge pull request #5823 from jsquyres/pr/v4.0.x/fix-tcp-btl-show-help-ip-address
v4.0.x: btl/tcp: output the IP address correctly
Этот коммит содержится в:
Коммит
593d652077
@ -901,17 +901,22 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
|
|||||||
/* No further use of this socket. Close it */
|
/* No further use of this socket. Close it */
|
||||||
CLOSE_THE_SOCKET(sd);
|
CLOSE_THE_SOCKET(sd);
|
||||||
{
|
{
|
||||||
char *addr_str = NULL, *tmp, *pnet;
|
char *addr_str = NULL, *tmp;
|
||||||
|
char ip[128];
|
||||||
|
ip[sizeof(ip) - 1] = '\0';
|
||||||
|
|
||||||
for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) {
|
for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) {
|
||||||
mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i];
|
mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i];
|
||||||
if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) {
|
if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pnet = opal_net_get_hostname((struct sockaddr*)&btl_endpoint->endpoint_addr->addr_inet);
|
inet_ntop(btl_endpoint->endpoint_addr->addr_family,
|
||||||
|
(void*) &(btl_endpoint->endpoint_addr->addr_inet),
|
||||||
|
ip, sizeof(ip) - 1);
|
||||||
if (NULL == addr_str) {
|
if (NULL == addr_str) {
|
||||||
(void)asprintf(&tmp, "\n\t%s", pnet);
|
(void)asprintf(&tmp, "\n\t%s", ip);
|
||||||
} else {
|
} else {
|
||||||
(void)asprintf(&tmp, "%s\n\t%s", addr_str, pnet);
|
(void)asprintf(&tmp, "%s\n\t%s", addr_str, ip);
|
||||||
free(addr_str);
|
free(addr_str);
|
||||||
}
|
}
|
||||||
addr_str = tmp;
|
addr_str = tmp;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user