]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
threading: simplify packetpool checks
authorVictor Julien <victor@inliniac.net>
Sun, 3 Nov 2019 08:58:34 +0000 (09:58 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 7 Feb 2020 14:43:10 +0000 (15:43 +0100)
src/tm-threads.c

index 95c14e1a5d3a2e958018a89c56eed3d084033968..c32512b8a9ccd4c1e24c8188be679ee7ccfcde01 100644 (file)
@@ -1425,19 +1425,16 @@ void TmThreadRemove(ThreadVars *tv, int type)
 
 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
          * kill this thread.  Do note that you should have disabled
          * packet acquire by now using TmThreadDisableReceiveThreads()*/
-        if (!(strlen(tv->inq->name) == strlen("packetpool") &&
-              strcasecmp(tv->inq->name, "packetpool") == 0)) {
-            PacketQueue *q = &trans_q[tv->inq->id];
-            SCMutexLock(&q->mutex_q);
-            uint32_t len = q->len;
-            SCMutexUnlock(&q->mutex_q);
-            if (len != 0) {
-                return true;
-            }
+        PacketQueue *q = &trans_q[tv->inq->id];
+        SCMutexLock(&q->mutex_q);
+        uint32_t len = q->len;
+        SCMutexUnlock(&q->mutex_q);
+        if (len != 0) {
+            return true;
         }
     }