From b862961cdb62e9ded39d574bc3bf3b8a08ec9f03 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 29 Feb 2024 20:18:12 +0000 Subject: [PATCH] Shortcut probe search for earliest since they are in order by send time. --- scan_engine.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scan_engine.cc b/scan_engine.cc index d15b91ecb..b5743b58b 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -598,6 +598,9 @@ bool HostScanStats::sendOK(struct timeval *when) const { if (TIMEVAL_BEFORE(probe_to, earliest_to)) { earliest_to = probe_to; } + // probes_outstanding is in order by time sent, so + // the first one we find is the earliest. + break; } } @@ -646,6 +649,9 @@ bool HostScanStats::nextTimeout(struct timeval *when) const { if (TIMEVAL_BEFORE(probe->sent, earliest_to)) { earliest_to = probe->sent; } + // probes_outstanding is in order by time sent, so + // the first one we find is the earliest. + break; } } if (pending_probes) {