From 7bba5dc62523c161be5fe68946c1aee203e5b981 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 9 Feb 2023 17:18:10 +0000 Subject: [PATCH] Fix signedness issue by making a constant a macro --- scan_engine.cc | 8 ++++---- scan_engine.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scan_engine.cc b/scan_engine.cc index b0299e2bc..e7c001db0 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -100,6 +100,8 @@ extern "C" int g_has_npcap_loopback; /* How long extra to wait before retransmitting for rate-limit detection */ #define RLD_TIME_MS 1000 +/* Keep a completed host around for a standard TCP MSL (2 min) */ +#define COMPL_HOST_LIFETIME_MS 120000 int HssPredicate::operator() (const HostScanStats *lhs, const HostScanStats *rhs) const { const struct sockaddr_storage *lss, *rss; @@ -916,8 +918,6 @@ void UltraScanInfo::Init(std::vector &Targets, const struct scan_lists set_default_port_state(Targets, scantype); - /* Keep a completed host around for a standard TCP MSL (2 min) */ - completedHostLifetime = 120000; memset(&lastCompletedHostRemoval, 0, sizeof(lastCompletedHostRemoval)); for (targetno = 0; targetno < Targets.size(); targetno++) { @@ -1145,10 +1145,10 @@ int UltraScanInfo::removeCompletedHosts() { struct timeval compare; /* We don't want to run this all of the time */ - TIMEVAL_MSEC_ADD(compare, lastCompletedHostRemoval, completedHostLifetime / 2); + TIMEVAL_MSEC_ADD(compare, lastCompletedHostRemoval, COMPL_HOST_LIFETIME_MS / 2); if (TIMEVAL_AFTER(now, compare) ) { /* Remove any that were completed before this time: */ - TIMEVAL_MSEC_ADD(compare, now, -completedHostLifetime); + TIMEVAL_MSEC_ADD(compare, now, -COMPL_HOST_LIFETIME_MS); for (hostI = completedHosts.begin(); hostI != completedHosts.end(); hostI = nxt) { nxt = hostI; nxt++; diff --git a/scan_engine.h b/scan_engine.h index 59b8a95b3..57d1931d6 100644 --- a/scan_engine.h +++ b/scan_engine.h @@ -616,8 +616,6 @@ public: completed. We keep them around because sometimes responses come back very late, after we consider a host completed. */ std::multiset completedHosts; - /* How long (in msecs) we keep a host in completedHosts */ - unsigned int completedHostLifetime; /* The last time we went through completedHosts to remove hosts */ struct timeval lastCompletedHostRemoval;