mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Reduce redundant loop
Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
This commit is contained in:
parent
9692a8d961
commit
b178f26e52
@ -413,7 +413,6 @@ void DnsResolver(THREAD *t, void *param)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
hints.ai_family = AF_INET;
|
hints.ai_family = AF_INET;
|
||||||
hints.ai_flags = AI_ADDRCONFIG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct addrinfo *results;
|
struct addrinfo *results;
|
||||||
@ -434,21 +433,30 @@ void DnsResolver(THREAD *t, void *param)
|
|||||||
Copy(&resolver->IPv6, &ip, sizeof(resolver->IPv6));
|
Copy(&resolver->IPv6, &ip, sizeof(resolver->IPv6));
|
||||||
resolver->IPv6.ipv6_scope_id = in->sin6_scope_id;
|
resolver->IPv6.ipv6_scope_id = in->sin6_scope_id;
|
||||||
ipv6_ok = true;
|
ipv6_ok = true;
|
||||||
|
if (ipv4_ok)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (IsIP4(&ip) && ipv4_ok == false)
|
else if (IsIP4(&ip) && ipv4_ok == false)
|
||||||
{
|
{
|
||||||
Copy(&resolver->IPv4, &ip, sizeof(resolver->IPv4));
|
Copy(&resolver->IPv4, &ip, sizeof(resolver->IPv4));
|
||||||
ipv4_ok = true;
|
ipv4_ok = true;
|
||||||
|
if (ipv6_ok)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const struct sockaddr_in *in = (struct sockaddr_in *)result->ai_addr;
|
const struct sockaddr_in *in = (struct sockaddr_in *)result->ai_addr;
|
||||||
InAddrToIP(&ip, &in->sin_addr);
|
InAddrToIP(&ip, &in->sin_addr);
|
||||||
if (IsIP4(&ip) && ipv4_ok == false)
|
if (IsIP4(&ip))
|
||||||
{
|
{
|
||||||
Copy(&resolver->IPv4, &ip, sizeof(resolver->IPv4));
|
Copy(&resolver->IPv4, &ip, sizeof(resolver->IPv4));
|
||||||
ipv4_ok = true;
|
ipv4_ok = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9892,7 +9892,9 @@ bool HasIPv6Address()
|
|||||||
if ((type & IPV6_ADDR_GLOBAL_UNICAST) && ((type & IPV6_ADDR_ZERO) == 0) && ((type & IPV6_ADDR_LOOPBACK) == 0))
|
if ((type & IPV6_ADDR_GLOBAL_UNICAST) && ((type & IPV6_ADDR_ZERO) == 0) && ((type & IPV6_ADDR_LOOPBACK) == 0))
|
||||||
{
|
{
|
||||||
ret = true;
|
ret = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user