From 22ee545f7e190d4c90cf0313bf74053a406eb6bc Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 18 Apr 2024 19:16:23 +0000 Subject: [PATCH] Erase by key --- nmap_dns.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nmap_dns.cc b/nmap_dns.cc index d77a75a531..2b9addbf9f 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -527,9 +527,7 @@ static int deal_with_timedout_reads() { servI->capacity = (int) (servI->capacity * CAPACITY_MINOR_DOWN_SCALE); check_capacities(&*servI); servI->in_process.erase(reqI); - std::map::iterator it = records.find(tpreq->id); - if ( it != records.end() ) - records.erase(it); + records.erase(tpreq->id); servI->reqs_on_wire--; // If we've tried this server enough times, move to the next one @@ -558,9 +556,7 @@ static int deal_with_timedout_reads() { output_summary(); stat_dropped++; total_reqs--; - infoI = records.find(tpreq->id); - if ( infoI != records.end() ) - records.erase(infoI); + records.erase(tpreq->id); delete tpreq; // **** OR We start at the back of this server's queue