diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-01-29 01:33:29 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-01-29 01:56:36 +0100 |
commit | 49297d937ce6128b2c9f1fb09199dd7d4f2404b7 (patch) | |
tree | f6528f67285249b58af6bdd48cd558c0f023b421 /drivers/unix | |
parent | 252ec22ff9fc2befd6b120fd40b0e008137a0392 (diff) |
[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.
Diffstat (limited to 'drivers/unix')
-rw-r--r-- | drivers/unix/ip_unix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 400dc25f11..d82dcb8a8d 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -115,7 +115,7 @@ void IPUnix::_resolve_hostname(List<IPAddress> &r_addresses, const String &p_hos continue; } IPAddress 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; |