slot->SlotFunc = tm->Func;
} else if (tm->PktAcqLoop) {
slot->PktAcqLoop = tm->PktAcqLoop;
+ if (tm->PktAcqBreakLoop) {
+ tv->break_loop = true;
+ }
} else if (tm->Management) {
slot->Management = tm->Management;
}
return thread_max;
}
+static inline void ThreadBreakLoop(ThreadVars *tv)
+{
+ if ((tv->tmm_flags & TM_FLAG_RECEIVE_TM) == 0) {
+ return;
+ }
+ /* find the correct slot */
+ TmSlot *s = tv->tm_slots;
+ TmModule *tm = TmModuleGetById(s->tm_id);
+ if (tm->flags & TM_FLAG_RECEIVE_TM) {
+ /* if the method supports it, BreakLoop. Otherwise we rely on
+ * the capture method's recv timeout */
+ if (tm->PktAcqLoop && tm->PktAcqBreakLoop) {
+ tm->PktAcqBreakLoop(tv, SC_ATOMIC_GET(s->slot_data));
+ }
+ }
+}
+
/**
* \retval r 1 if packet was accepted, 0 otherwise
* \note if packet was not accepted, it's still the responsibility
/* wake up listening thread(s) if necessary */
if (tv->inq != NULL) {
SCCondSignal(&tv->inq->pq->cond_q);
+ } else if (tv->break_loop) {
+ ThreadBreakLoop(tv);
}
return 1;
}
/* wake up listening thread(s) if necessary */
if (tv->inq != NULL) {
SCCondSignal(&tv->inq->pq->cond_q);
+ } else if (tv->break_loop) {
+ ThreadBreakLoop(tv);
}
}