1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 04:09:01 +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;
long tdiff;
if (target->timedOut(&USI->now) || completed()) {
if ((!USI->ping_scan && target->timedOut(&USI->now)) || completed()) {
if (when)
*when = USI->now;
return false;
@@ -1167,8 +1167,8 @@ int UltraScanInfo::removeCompletedHosts() {
nxt = hostI;
nxt++;
hss = *hostI;
timedout = hss->target->timedOut(&now);
if (hss->completed() || timedout) {
// Don't bother checking timedOut for discovery scans or if the target is already completed.
if (hss->completed() || (timedout = (!ping_scan) && hss->target->timedOut(&now)) != false) {
/* A host to remove! First adjust nextI appropriately */
if (nextI == hostI && incompleteHosts.size() > 1) {
nextI++;