1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-04 13:49:03 +00:00

Move a calculation outside the loop

This commit is contained in:
dmiller
2022-12-12 21:01:36 +00:00
parent de17b51988
commit 117b0e2b2b

View File

@@ -1147,6 +1147,8 @@ int UltraScanInfo::removeCompletedHosts() {
/* We don't want to run this all of the time */
TIMEVAL_MSEC_ADD(compare, lastCompletedHostRemoval, completedHostLifetime / 2);
if (TIMEVAL_AFTER(now, compare) ) {
/* Remove any that were completed before this time: */
TIMEVAL_MSEC_ADD(compare, now, -completedHostLifetime);
for (hostI = completedHosts.begin(); hostI != completedHosts.end(); hostI = nxt) {
nxt = hostI;
nxt++;
@@ -1156,8 +1158,7 @@ int UltraScanInfo::removeCompletedHosts() {
if (hss == gstats->pinghost)
continue;
TIMEVAL_MSEC_ADD(compare, hss->completiontime, completedHostLifetime);
if (TIMEVAL_AFTER(now, compare) ) {
if (TIMEVAL_BEFORE(hss->completiontime, compare) ) {
/* Any active probes in completed hosts count against our global
* cwnd, so be sure to remove them or we can run out of space. */
hss->destroyAllOutstandingProbes();