Fix logic for failed DNS TXT lookups.

A failed request should not evict a previous result from the local
cache/mapping.
This commit is contained in:
Jon Siwek 2013-09-25 12:04:07 -05:00
parent 3c37e818ce
commit 2203600e05

View file

@ -711,17 +711,19 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
if ( dr->ReqIsTxt() ) if ( dr->ReqIsTxt() )
{ {
TextMap::iterator it = text_mappings.find(dr->ReqHost()); TextMap::iterator it = text_mappings.find(dr->ReqHost());
if ( it == text_mappings.end() ) if ( it == text_mappings.end() )
text_mappings[dr->ReqHost()] = new_dm; text_mappings[dr->ReqHost()] = new_dm;
else else
{ {
if ( new_dm->Failed() && prev_dm && prev_dm->Valid() ) prev_dm = it->second;
++keep_prev; it->second = new_dm;
else }
{
prev_dm = it->second; if ( new_dm->Failed() && prev_dm && prev_dm->Valid() )
it->second = new_dm; {
} text_mappings[dr->ReqHost()] = prev_dm;
++keep_prev;
} }
} }
else else