host/iprep: run all timeout logic

Run all timeout logic if iprep is in use as well.

Minor code cleanups.

Bug: #6436.
pull/9727/head
Victor Julien 3 years ago committed by Victor Julien
parent 80f13b93aa
commit 6307a4d4b9

@ -53,9 +53,7 @@ uint32_t HostGetActiveCount(void)
*/
static int HostHostTimedOut(Host *h, SCTime_t ts)
{
int tags = 0;
int thresholds = 0;
int vars = 0;
int busy = 0;
/** never prune a host that is used by a packet
* we are currently processing in one of the threads */
@ -63,28 +61,12 @@ static int HostHostTimedOut(Host *h, SCTime_t ts)
return 0;
}
if (h->iprep) {
if (SRepHostTimedOut(h) == 0)
return 0;
SCLogDebug("host %p reputation timed out", h);
}
if (TagHostHasTag(h) && TagTimeoutCheck(h, ts) == 0) {
tags = 1;
}
if (ThresholdHostHasThreshold(h) && ThresholdHostTimeoutCheck(h, ts) == 0) {
thresholds = 1;
}
if (HostHasHostBits(h) && HostBitsTimedoutCheck(h, ts) == 0) {
vars = 1;
}
if (tags || thresholds || vars)
return 0;
SCLogDebug("host %p timed out", h);
return 1;
busy |= (h->iprep && SRepHostTimedOut(h) == 0);
busy |= (TagHostHasTag(h) && TagTimeoutCheck(h, ts) == 0);
busy |= (ThresholdHostHasThreshold(h) && ThresholdHostTimeoutCheck(h, ts) == 0);
busy |= (HostHasHostBits(h) && HostBitsTimedoutCheck(h, ts) == 0);
SCLogDebug("host %p %s", h, busy ? "still active" : "timed out");
return !busy;
}
/**

Loading…
Cancel
Save