From 00a644c5c2d66a7f5000ce62ffdd068b88f5d1a8 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 21 Jun 2024 13:42:24 +0530 Subject: [PATCH] flow/manager: make fn calls only when necessary --- src/flow-manager.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/flow-manager.c b/src/flow-manager.c index e085fffa6b..5eeeca15c9 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -196,6 +196,7 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons return true; } +#ifdef CAPTURE_OFFLOAD /** \internal * \brief check timeout of captured bypassed flow by querying capture method * @@ -208,7 +209,6 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons */ static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters *counters) { -#ifdef CAPTURE_OFFLOAD if (f->flow_state != FLOW_STATE_CAPTURE_BYPASSED) { return true; } @@ -245,9 +245,9 @@ static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters } counters->bypassed_count++; } -#endif /* CAPTURE_OFFLOAD */ return true; } +#endif /* CAPTURE_OFFLOAD */ typedef struct FlowManagerTimeoutThread { /* used to temporarily store flows that have timed out and are @@ -342,6 +342,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *f, SCT Flow *next_flow = f->next; +#ifdef CAPTURE_OFFLOAD /* never prune a flow that is used by a packet we * are currently processing in one of the threads */ if (!FlowBypassedTimeout(f, ts, counters)) { @@ -350,7 +351,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *f, SCT f = f->next; continue; } - +#endif f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT; counters->flows_timeout++;