deltachat-core-rust
deltachat-core-rust copied to clipboard
Prioritize cached DNS results over DNS resolver results
If DNS resolver returns a lot of results we should not prioritize all of them over cached results. DNS server may be misconfigured, return malicious results (100 of blackhole IP addresses that never respond and take 1 minute each to connection timeout on them) etc. Even with parallelization #5915 it may take a long time to try all the results.
lookup_host_with_cache
should return DNS results first, but probably take some fixed number of them e.g. first two or the first one and random one, then follow with cached recently working results and then return some of the remaining DNS resolver results. So DNS load balancing should still work and on a good network we should try the first returned DNS result first, but if DNS results are bad it should never take forever until we try the IP address that worked last time.