From 6998d72ccc1a56b34ffec150dcb78f02a3bf67d4 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 3 Jan 2009 22:04:43 +0000 Subject: [PATCH] Short-circuit HostScanStats::completed in host discovery: once we know the host is up or down, we can move it to the completed list, regardless of any active probes. However I can imagine changing this so that we move it when it is found up, or when it is found down and there are no probes left to send. That would give a down host a chance to become up with a different probe later on. --- scan_engine.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scan_engine.cc b/scan_engine.cc index 0af5929e3..69a34bbda 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -2172,18 +2172,18 @@ void HostScanStats::markProbeTimedout(list::iterator probeI) { } bool HostScanStats::completed() { - /* If there are probes active or awaiting retransmission, we are not done. */ - if (num_probes_active != 0 || num_probes_waiting_retransmit != 0 - || !probe_bench.empty() || !retry_stack.empty()) { - return false; - } - /* With ping scan, we are done once we know the host is up or down. */ if (USI->ping_scan && ((target->flags & HOST_UP) || (target->flags & HOST_DOWN) || target->weird_responses)) { return true; } + /* If there are probes active or awaiting retransmission, we are not done. */ + if (num_probes_active != 0 || num_probes_waiting_retransmit != 0 + || !probe_bench.empty() || !retry_stack.empty()) { + return false; + } + /* With other types of scan, we are done when there are no more ports to probe. */ return freshPortsLeft() == 0;