1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 02:49:01 +00:00

Optimize loop check in doAnyOutstandingRetransmits: head of list does not change

This commit is contained in:
dmiller
2024-03-01 19:29:54 +00:00
parent 938c3c7081
commit 44c3b5abc8

View File

@@ -2462,6 +2462,8 @@ static void doAnyOutstandingRetransmits(UltraScanInfo *USI) {
pci++) {
host = pci->hss;
std::list<UltraProbe *>::iterator &probeI = pci->probeI;
// Nothing drops off list during this function
const std::list<UltraProbe *>::const_iterator &beginI = host->probes_outstanding.begin();
/* Skip this host if it has nothing to send. */
if ((host->num_probes_active == 0
&& host->num_probes_waiting_retransmit == 0))
@@ -2494,10 +2496,10 @@ static void doAnyOutstandingRetransmits(UltraScanInfo *USI) {
}
break; /* I only do one probe per host for now to spread load */
}
} while (probeI != host->probes_outstanding.begin());
} while (probeI != beginI);
/* Wrap the probe iterator around. */
if (probeI == host->probes_outstanding.begin())
if (probeI == beginI)
probeI = host->probes_outstanding.end();
}
} while (USI->gstats->sendOK(NULL) && retrans != 0);