From 937ba71491f147d46517ba7701d85ae43558287e Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 13 Sep 2012 11:57:07 +0200 Subject: [PATCH] defrag: don't return after a cleaning. This patch changes the policy of the timeout function by cleaning every timeouted trackers. Previous code was only freeing the first tracker and this was resulting in calling the timeout function continuously. One of my previous patch has modified the function to avoid to run it more than twice a second. But as it was not taken into account the fact only the first tracker was freed, the result was that a lot of tracker could not be allocated. --- src/defrag.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/defrag.c b/src/defrag.c index 0f7bc696ba..6cd548003a 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -1012,10 +1012,10 @@ done: } /** - * \brief Timeout a tracker. + * \brief Timeout trackers. * - * Called when we fail to get a tracker from the pool. The first - * tracker that has expired will be released back to the pool then the + * Called when we fail to get a tracker from the pool. The trackers + * that has expired will be released back to the pool then the * function will exit. * * Intended to be called with the tracker pool already locked. @@ -1040,6 +1040,7 @@ DefragTimeoutTracker(ThreadVars *tv, DecodeThreadVars *dtv, DefragContext *dc, } while (next != NULL) { tracker = HashListTableGetListData(next); + next = HashListTableGetListNext(next); if (tracker->timeout < (unsigned int)p->ts.tv_sec) { int af_family = tracker->af; @@ -1057,10 +1058,7 @@ DefragTimeoutTracker(ThreadVars *tv, DecodeThreadVars *dtv, DefragContext *dc, tv->sc_perf_pca); } } - return; } - - next = HashListTableGetListNext(next); } } -- 2.47.3