threading: simplify packetpool checks

pull/4531/head
Victor Julien 6 years ago
parent 603b2ced47
commit b1056b3836

@ -1425,19 +1425,16 @@ void TmThreadRemove(ThreadVars *tv, int type)
static bool ThreadStillHasPackets(ThreadVars *tv) static bool ThreadStillHasPackets(ThreadVars *tv)
{ {
if (tv->inq != NULL) { if (tv->inq != NULL && !tv->inq->is_packet_pool) {
/* we wait till we dry out all the inq packets, before we /* we wait till we dry out all the inq packets, before we
* kill this thread. Do note that you should have disabled * kill this thread. Do note that you should have disabled
* packet acquire by now using TmThreadDisableReceiveThreads()*/ * packet acquire by now using TmThreadDisableReceiveThreads()*/
if (!(strlen(tv->inq->name) == strlen("packetpool") && PacketQueue *q = &trans_q[tv->inq->id];
strcasecmp(tv->inq->name, "packetpool") == 0)) { SCMutexLock(&q->mutex_q);
PacketQueue *q = &trans_q[tv->inq->id]; uint32_t len = q->len;
SCMutexLock(&q->mutex_q); SCMutexUnlock(&q->mutex_q);
uint32_t len = q->len; if (len != 0) {
SCMutexUnlock(&q->mutex_q); return true;
if (len != 0) {
return true;
}
} }
} }

Loading…
Cancel
Save