{
SCMutexLock(&tv_root_lock);
for (ThreadVars *tv = tv_root[TVT_PPT]; tv != NULL; tv = tv->next) {
+ if ((tv->tmm_flags & TM_FLAG_RECEIVE_TM) == 0) {
+ continue;
+ }
/* find the correct slot */
- TmSlot *slots = tv->tm_slots;
- while (slots != NULL) {
+ for (TmSlot *s = tv->tm_slots; s != NULL; s = s->slot_next) {
if (suricata_ctl_flags != 0) {
SCMutexUnlock(&tv_root_lock);
return;
}
- TmModule *tm = TmModuleGetById(slots->tm_id);
+ TmModule *tm = TmModuleGetById(s->tm_id);
if (!(tm->flags & TM_FLAG_RECEIVE_TM)) {
- slots = slots->slot_next;
continue;
}
/* 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(slots->slot_data));
+ tm->PktAcqBreakLoop(tv, SC_ATOMIC_GET(s->slot_data));
}
-
break;
}
}
/* get reference to tv's and setup new_det_ctx array */
SCMutexLock(&tv_root_lock);
for (ThreadVars *tv = tv_root[TVT_PPT]; tv != NULL; tv = tv->next) {
- /* obtain the slots for this TV */
- TmSlot *slots = tv->tm_slots;
- while (slots != NULL) {
- TmModule *tm = TmModuleGetById(slots->tm_id);
+ if ((tv->tmm_flags & TM_FLAG_DETECT_TM) == 0) {
+ continue;
+ }
+ for (TmSlot *s = tv->tm_slots; s != NULL; s = s->slot_next) {
+ TmModule *tm = TmModuleGetById(s->tm_id);
+ if (!(tm->flags & TM_FLAG_DETECT_TM)) {
+ continue;
+ }
if (suricata_ctl_flags != 0) {
SCMutexUnlock(&tv_root_lock);
goto error;
}
- if (!(tm->flags & TM_FLAG_DETECT_TM)) {
- slots = slots->slot_next;
- continue;
- }
-
- old_det_ctx[i] = FlowWorkerGetDetectCtxPtr(SC_ATOMIC_GET(slots->slot_data));
+ old_det_ctx[i] = FlowWorkerGetDetectCtxPtr(SC_ATOMIC_GET(s->slot_data));
detect_tvs[i] = tv;
new_det_ctx[i] = DetectEngineThreadCtxInitForReload(tv, new_de_ctx, 1);
/* atomicly replace the det_ctx data */
i = 0;
for (ThreadVars *tv = tv_root[TVT_PPT]; tv != NULL; tv = tv->next) {
- /* find the correct slot */
- TmSlot *slots = tv->tm_slots;
- while (slots != NULL) {
- TmModule *tm = TmModuleGetById(slots->tm_id);
+ if ((tv->tmm_flags & TM_FLAG_DETECT_TM) == 0) {
+ continue;
+ }
+ for (TmSlot *s = tv->tm_slots; s != NULL; s = s->slot_next) {
+ TmModule *tm = TmModuleGetById(s->tm_id);
if (!(tm->flags & TM_FLAG_DETECT_TM)) {
- slots = slots->slot_next;
continue;
}
SCLogDebug("swapping new det_ctx - %p with older one - %p",
- new_det_ctx[i], SC_ATOMIC_GET(slots->slot_data));
- FlowWorkerReplaceDetectCtx(SC_ATOMIC_GET(slots->slot_data), new_det_ctx[i++]);
+ new_det_ctx[i], SC_ATOMIC_GET(s->slot_data));
+ FlowWorkerReplaceDetectCtx(SC_ATOMIC_GET(s->slot_data), new_det_ctx[i++]);
break;
}
}
* THV_DEINIT flag */
if (i != no_of_detect_tvs) { // not all threads we swapped
for (ThreadVars *tv = tv_root[TVT_PPT]; tv != NULL; tv = tv->next) {
- /* obtain the slots for this TV */
- TmSlot *slots = tv->tm_slots;
- while (slots != NULL) {
- TmModule *tm = TmModuleGetById(slots->tm_id);
- if (!(tm->flags & TM_FLAG_DETECT_TM)) {
- slots = slots->slot_next;
- continue;
- }
-
- while (!TmThreadsCheckFlag(tv, THV_RUNNING_DONE)) {
- usleep(100);
- }
+ if ((tv->tmm_flags & TM_FLAG_DETECT_TM) == 0) {
+ continue;
+ }
- slots = slots->slot_next;
+ while (!TmThreadsCheckFlag(tv, THV_RUNNING_DONE)) {
+ usleep(100);
}
}
}