f = fb->head;
do {
Flow *next_f = NULL;
+ FLOWLOCK_WRLOCK(f);
const bool timedout = (fb_nextts < (uint32_t)SCTIME_SECS(p->ts) &&
FlowIsTimedOut(f, (uint32_t)SCTIME_SECS(p->ts), emerg));
if (timedout) {
- FLOWLOCK_WRLOCK(f);
next_f = f->next;
MoveToWorkQueue(tv, fls, fb, f, prev_f);
FLOWLOCK_UNLOCK(f);
goto flow_removed;
} else if (FlowCompare(f, p) != 0) {
- FLOWLOCK_WRLOCK(f);
/* found a matching flow that is not timed out */
if (unlikely(TcpSessionPacketSsnReuse(p, f, f->protoctx))) {
Flow *new_f = TcpReuseReplace(tv, fls, fb, f, hash, p);
FlowReference(dest, f);
FBLOCK_UNLOCK(fb);
return f; /* return w/o releasing flow lock */
+ } else {
+ FLOWLOCK_UNLOCK(f);
}
/* unless we removed 'f', prev_f needs to point to
* current 'f' when adding a new flow below. */
do {
checked++;
+ FLOWLOCK_WRLOCK(f);
+
/* check flow timeout based on lastts and state. Both can be
* accessed w/o Flow lock as we do have the hash row lock (so flow
* can't disappear) and flow_state is atomic. lastts can only
/* timeout logic goes here */
if (FlowManagerFlowTimeout(f, ts, next_ts, emergency) == false) {
+ FLOWLOCK_UNLOCK(f);
counters->flows_notimeout++;
prev_f = f;
continue;
}
- FLOWLOCK_WRLOCK(f);
-
Flow *next_flow = f->next;
#ifdef CAPTURE_OFFLOAD