|
|
|
@ -67,8 +67,10 @@ static uint32_t DefragTrackerHashRowTimeout(
|
|
|
|
|
{
|
|
|
|
|
uint32_t cnt = 0;
|
|
|
|
|
|
|
|
|
|
DefragTracker *prev_dt = NULL;
|
|
|
|
|
do {
|
|
|
|
|
if (SCMutexTrylock(&dt->lock) != 0) {
|
|
|
|
|
prev_dt = dt;
|
|
|
|
|
dt = dt->hnext;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -77,19 +79,21 @@ static uint32_t DefragTrackerHashRowTimeout(
|
|
|
|
|
|
|
|
|
|
/* check if the tracker is fully timed out and
|
|
|
|
|
* ready to be discarded. */
|
|
|
|
|
if (DefragTrackerTimedOut(dt, ts) == 1) {
|
|
|
|
|
if (DefragTrackerTimedOut(dt, ts) == 0) {
|
|
|
|
|
prev_dt = dt;
|
|
|
|
|
SCMutexUnlock(&dt->lock);
|
|
|
|
|
dt = next_dt;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* remove from the hash */
|
|
|
|
|
if (dt->hprev != NULL)
|
|
|
|
|
dt->hprev->hnext = dt->hnext;
|
|
|
|
|
if (dt->hnext != NULL)
|
|
|
|
|
dt->hnext->hprev = dt->hprev;
|
|
|
|
|
if (hb->head == dt)
|
|
|
|
|
if (prev_dt != NULL) {
|
|
|
|
|
prev_dt->hnext = dt->hnext;
|
|
|
|
|
} else {
|
|
|
|
|
hb->head = dt->hnext;
|
|
|
|
|
if (hb->tail == dt)
|
|
|
|
|
hb->tail = dt->hprev;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dt->hnext = NULL;
|
|
|
|
|
dt->hprev = NULL;
|
|
|
|
|
|
|
|
|
|
DefragTrackerClearMemory(dt);
|
|
|
|
|
|
|
|
|
@ -101,9 +105,6 @@ static uint32_t DefragTrackerHashRowTimeout(
|
|
|
|
|
DefragTrackerMoveToSpare(dt);
|
|
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
} else {
|
|
|
|
|
SCMutexUnlock(&dt->lock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dt = next_dt;
|
|
|
|
|
} while (dt != NULL);
|
|
|
|
|