1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 12:19:02 +00:00

Avoid a few calls to Target::timedOut, which is not relevant in host discovery

This commit is contained in:
dmiller
2020-10-26 16:59:06 +00:00
parent c3f8620f1a
commit e317dfdb8a

View File

@@ -542,7 +542,7 @@ bool HostScanStats::sendOK(struct timeval *when) {
struct timeval probe_to, earliest_to, sendTime; struct timeval probe_to, earliest_to, sendTime;
long tdiff; long tdiff;
if (target->timedOut(&USI->now) || completed()) { if ((!USI->ping_scan && target->timedOut(&USI->now)) || completed()) {
if (when) if (when)
*when = USI->now; *when = USI->now;
return false; return false;
@@ -1167,8 +1167,8 @@ int UltraScanInfo::removeCompletedHosts() {
nxt = hostI; nxt = hostI;
nxt++; nxt++;
hss = *hostI; hss = *hostI;
timedout = hss->target->timedOut(&now); // Don't bother checking timedOut for discovery scans or if the target is already completed.
if (hss->completed() || timedout) { if (hss->completed() || (timedout = (!ping_scan) && hss->target->timedOut(&now)) != false) {
/* A host to remove! First adjust nextI appropriately */ /* A host to remove! First adjust nextI appropriately */
if (nextI == hostI && incompleteHosts.size() > 1) { if (nextI == hostI && incompleteHosts.size() > 1) {
nextI++; nextI++;