version 1.419, 2022/05/05 00:56:58 |
version 1.420, 2022/09/19 08:49:50 |
|
|
if (getnameinfo(cctx->ai->ai_addr, cctx->ai->ai_addrlen, |
if (getnameinfo(cctx->ai->ai_addr, cctx->ai->ai_addrlen, |
ntop, sizeof(ntop), strport, sizeof(strport), |
ntop, sizeof(ntop), strport, sizeof(strport), |
NI_NUMERICHOST|NI_NUMERICSERV) != 0) { |
NI_NUMERICHOST|NI_NUMERICSERV) != 0) { |
error("connect_next: getnameinfo failed"); |
error_f("getnameinfo failed"); |
continue; |
continue; |
} |
} |
break; |
break; |
default: |
default: |
continue; |
continue; |
} |
} |
|
debug_f("start for host %.100s ([%.100s]:%s)", |
|
cctx->host, ntop, strport); |
if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype, |
if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype, |
cctx->ai->ai_protocol)) == -1) { |
cctx->ai->ai_protocol)) == -1) { |
if (cctx->ai->ai_next == NULL) |
if (cctx->ai->ai_next == NULL) |
|
|
fatal_f("set_nonblock(%d)", sock); |
fatal_f("set_nonblock(%d)", sock); |
if (connect(sock, cctx->ai->ai_addr, |
if (connect(sock, cctx->ai->ai_addr, |
cctx->ai->ai_addrlen) == -1 && errno != EINPROGRESS) { |
cctx->ai->ai_addrlen) == -1 && errno != EINPROGRESS) { |
debug("connect_next: host %.100s ([%.100s]:%s): " |
debug_f("host %.100s ([%.100s]:%s): %.100s", |
"%.100s", cctx->host, ntop, strport, |
cctx->host, ntop, strport, strerror(errno)); |
strerror(errno)); |
|
saved_errno = errno; |
saved_errno = errno; |
close(sock); |
close(sock); |
errno = saved_errno; |
errno = saved_errno; |
|
|
} |
} |
if (cctx->ai->ai_family != AF_UNIX) |
if (cctx->ai->ai_family != AF_UNIX) |
set_nodelay(sock); |
set_nodelay(sock); |
debug("connect_next: host %.100s ([%.100s]:%s) " |
debug_f("connect host %.100s ([%.100s]:%s) in progress, fd=%d", |
"in progress, fd=%d", cctx->host, ntop, strport, sock); |
cctx->host, ntop, strport, sock); |
cctx->ai = cctx->ai->ai_next; |
cctx->ai = cctx->ai->ai_next; |
return sock; |
return sock; |
} |
} |