mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
[Net] Simplify IP resolution code, fix caching.
First, we should not insert into cache if the hostname resolution has
failed (as it might be a temporary internet issue), second, the async
resolver should also properly insert into cache.
Took the chance to remove some duplicate code with critical section in
it at the cost of little performance when calling the blocking
resolve_hostname function.
(cherry picked from commit 49297d937c)
This commit is contained in:
parent
c25365d5ff
commit
aa3ef20fcb
2 changed files with 13 additions and 31 deletions
|
|
@ -115,7 +115,7 @@ void IP_Unix::_resolve_hostname(List<IP_Address> &r_addresses, const String &p_h
|
|||
continue;
|
||||
}
|
||||
IP_Address ip = _sockaddr2ip(next->ai_addr);
|
||||
if (!r_addresses.find(ip)) {
|
||||
if (ip.is_valid() && !r_addresses.find(ip)) {
|
||||
r_addresses.push_back(ip);
|
||||
}
|
||||
next = next->ai_next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue