mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-29 08:08:37 +00:00
Do retry next entry in addrinfo during connect.
MFC after: 1 week
This commit is contained in:
parent
27c775d7bf
commit
2c5958aa51
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77585
@ -220,12 +220,17 @@ whois(name, res, flags)
|
||||
size_t len;
|
||||
int s, nomatch;
|
||||
|
||||
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (s < 0) {
|
||||
err(EX_OSERR, "socket");
|
||||
for (; res; res = res->ai_next) {
|
||||
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (s < 0) {
|
||||
continue;
|
||||
}
|
||||
if (connect(s, res->ai_addr, res->ai_addrlen) == 0) {
|
||||
break;
|
||||
}
|
||||
close(s);
|
||||
}
|
||||
|
||||
if (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
|
||||
if (res == NULL) {
|
||||
err(EX_OSERR, "connect");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user