defrag: timeout/reuse start of list

pull/11227/head
Victor Julien 9 months ago committed by Victor Julien
parent 97705c94e4
commit 26a73503aa

@ -682,7 +682,7 @@ static DefragTracker *DefragTrackerGetUsedDefragTracker(void)
if (DRLOCK_TRYLOCK(hb) != 0)
continue;
DefragTracker *dt = hb->tail;
DefragTracker *dt = hb->head;
if (dt == NULL) {
DRLOCK_UNLOCK(hb);
continue;

@ -69,11 +69,11 @@ static uint32_t DefragTrackerHashRowTimeout(
do {
if (SCMutexTrylock(&dt->lock) != 0) {
dt = dt->hprev;
dt = dt->hnext;
continue;
}
DefragTracker *next_dt = dt->hprev;
DefragTracker *next_dt = dt->hnext;
/* check if the tracker is fully timed out and
* ready to be discarded. */
@ -131,13 +131,13 @@ uint32_t DefragTimeoutHash(SCTime_t ts)
/* defrag hash bucket is now locked */
if (hb->tail == NULL) {
if (hb->head == NULL) {
DRLOCK_UNLOCK(hb);
continue;
}
/* we have a tracker, or more than one */
cnt += DefragTrackerHashRowTimeout(hb, hb->tail, ts);
cnt += DefragTrackerHashRowTimeout(hb, hb->head, ts);
DRLOCK_UNLOCK(hb);
}

Loading…
Cancel
Save