From ef396f7509ccef47afa949eb1f463a29130213b5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 17 Sep 2024 20:52:14 +0200 Subject: [PATCH] flow/manager: in offline mode, use owning threads time As this may mean that a threads ts is a bit ahead of the minimum time the flow manager normally uses, it can evict flows a bit faster. Ticket: #7455. --- src/flow-manager.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/flow-manager.c b/src/flow-manager.c index 2a3d6f6f6a..52c7586a4f 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -198,9 +198,19 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons if (*next_ts == 0 || (uint32_t)SCTIME_SECS(timesout_at) < *next_ts) *next_ts = (uint32_t)SCTIME_SECS(timesout_at); - /* do the timeout check */ - if (SCTIME_CMP_LT(ts, timesout_at)) { - return false; + /* if time is live, we just use the `ts` */ + if (TimeModeIsLive() || f->thread_id[0] == 0) { + /* do the timeout check */ + if (SCTIME_CMP_LT(ts, timesout_at)) { + return false; + } + } else { + /* offline: take last ts from "owning" thread */ + SCTime_t checkts = TmThreadsGetThreadTime(f->thread_id[0]); + /* do the timeout check */ + if (SCTIME_CMP_LT(checkts, timesout_at)) { + return false; + } } return true;