mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Rate-limit capacity scale-downs to 1 per MIN_DNS_TIMEOUT
This commit is contained in:
14
nmap_dns.cc
14
nmap_dns.cc
@@ -556,7 +556,7 @@ static int deal_with_timedout_reads(bool adjust_timing) {
|
|||||||
if (nextI == servI->in_process.end()) continue;
|
if (nextI == servI->in_process.end()) continue;
|
||||||
|
|
||||||
struct timeval earliest_sent = now;
|
struct timeval earliest_sent = now;
|
||||||
bool adjusted = false;
|
bool adjusted = !adjust_timing;
|
||||||
bool may_increase = adjust_timing;
|
bool may_increase = adjust_timing;
|
||||||
do {
|
do {
|
||||||
reqI = nextI++;
|
reqI = nextI++;
|
||||||
@@ -1195,7 +1195,7 @@ static void nmap_mass_dns_core(DNS::Request *requests, int num_requests) {
|
|||||||
|
|
||||||
std::list<request *>::iterator reqI;
|
std::list<request *>::iterator reqI;
|
||||||
request *tpreq;
|
request *tpreq;
|
||||||
int timeout;
|
int timeout = 0;
|
||||||
int i;
|
int i;
|
||||||
char spmobuf[1024];
|
char spmobuf[1024];
|
||||||
|
|
||||||
@@ -1280,8 +1280,16 @@ static void nmap_mass_dns_core(DNS::Request *requests, int num_requests) {
|
|||||||
SPM = new ScanProgressMeter(spmobuf);
|
SPM = new ScanProgressMeter(spmobuf);
|
||||||
stat_actual = total_reqs;
|
stat_actual = total_reqs;
|
||||||
|
|
||||||
|
int since_last = 0;
|
||||||
while (total_reqs > 0) {
|
while (total_reqs > 0) {
|
||||||
timeout = deal_with_timedout_reads(true);
|
since_last += timeout;
|
||||||
|
if (since_last > MIN_DNS_TIMEOUT) {
|
||||||
|
since_last = 0;
|
||||||
|
timeout = deal_with_timedout_reads(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
timeout = deal_with_timedout_reads(false);
|
||||||
|
}
|
||||||
|
|
||||||
do_possible_writes();
|
do_possible_writes();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user