resolved: don't flush answer RRs on CNAME redirect too early
When doing a CNAME/DNAME redirect let's first check if the answer we already have fully answers the redirected question already. If so, let's use that. If not, let's properly restart things. This simply removes one call to dns_answer_reset() that was placed too early: instead of resetting when we detect a CNAME/DNAME redirect, do so only after checking if the answer we already have doesn't match the reply, and then decide to *actually* follow it. Or in other words: rely on the dns_answer_reset() call in dns_query_go() which we'll call to actually begin with the redirected question. This fixes an optimization path which was broken back in 7820b320. (This doesn't really matter as much as one might think, since our cache stepped in anyway and answered the questions before going back to the network. However, this adds noise if RRs with very short TTLs are cached – which some CDNs do – and is of course relavant when people turn off the local cache.)
Loading