From 50ceac5753f47d9de6a3b95d8bec49e017c2513f Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 16 May 2024 19:31:45 +0000 Subject: [PATCH] mass_dns: only scale back for initial requests Some requests just take longer; they may have lots of recursion or a slow authoritative server. That won't change on retransmissions, so if we treat all requests and retransmissions equally, we get a long tail of retransmits with smaller and smaller capacity (parallelism). Instead, we will use the initial-request period to determine server capacity and then not change it during the retransmit phase. --- nmap_dns.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nmap_dns.cc b/nmap_dns.cc index bd44a3262..0c2cfef8f 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -582,7 +582,7 @@ static int deal_with_timedout_reads(bool adjust_timing) { // If we've tried this server enough times, move to the next one if (read_timeouts[read_timeout_index][tpreq->tries] == -1) { - if (!adjusted) { + if (!adjusted && tpreq->servers_tried == 0) { servI->max_capacity = servI->capacity * 2; servI->capacity = (int) (servI->capacity * CAPACITY_MAJOR_DOWN_SCALE); check_capacities(&*servI); @@ -620,7 +620,7 @@ static int deal_with_timedout_reads(bool adjust_timing) { servItemp->to_process.push_back(tpreq); } } else { - if (!adjusted) { + if (!adjusted && tpreq->servers_tried == 0 && tpreq->tries <= 1) { servI->max_capacity = servI->capacity * 4; servI->capacity = (int) (servI->capacity * CAPACITY_MINOR_DOWN_SCALE); check_capacities(&*servI);