From 9a4ef6b8fc290a83ad0d17c036d8a93b5c02689c Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sat, 14 Aug 2021 23:05:03 +0200 Subject: [PATCH] flow: more accurate flow counters Don't increment the flow timeout counter for flows that are not really timeout (as use_cnt is non zero). And also don't take into account bypassed flows in the counter for flow timeout in use. --- src/flow-manager.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/flow-manager.c b/src/flow-manager.c index e1d8993556..40654f813e 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -392,20 +392,22 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *next_flow = f->next; - counters->flows_timeout++; - /* never prune a flow that is used by a packet we * are currently processing in one of the threads */ if (f->use_cnt > 0 || !FlowBypassedTimeout(f, ts, counters)) { FLOWLOCK_UNLOCK(f); prev_f = f; - counters->flows_timeout_inuse++; + if (f->use_cnt > 0) { + counters->flows_timeout_inuse++; + } f = f->next; continue; } f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT; + counters->flows_timeout++; + RemoveFromHash(f, prev_f); FlowQueuePrivateAppendFlow(&td->aside_queue, f);