diff --git a/src/host-timeout.c b/src/host-timeout.c index 75918f3eba..8542d5f78a 100644 --- a/src/host-timeout.c +++ b/src/host-timeout.c @@ -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; } /**