]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
threads: count thread types after all initialized
authorVictor Julien <vjulien@oisf.net>
Thu, 27 Oct 2022 10:17:11 +0000 (12:17 +0200)
committerVictor Julien <vjulien@oisf.net>
Thu, 27 Oct 2022 10:17:19 +0000 (12:17 +0200)
To avoid double counting in case a thread took longer than
expected to start up.

src/tm-threads.c

index 7a0f1958263377392eb053e285a4a3bc5466c788..75977cb249a2cbc6e3458d3c70b36abacc8939a8 100644 (file)
@@ -1830,7 +1830,11 @@ again:
                 SleepUsec(100);
                 goto again;
             }
-
+            tv = tv->next;
+        }
+    }
+    for (int i = 0; i < TVT_MAX; i++) {
+        for (ThreadVars *tv = tv_root[i]; tv != NULL; tv = tv->next) {
             if (strncmp(thread_name_autofp, tv->name, strlen(thread_name_autofp)) == 0)
                 RX_num++;
             else if (strncmp(thread_name_workers, tv->name, strlen(thread_name_workers)) == 0)
@@ -1841,8 +1845,6 @@ again:
                 FM_num++;
             else if (strncmp(thread_name_flow_rec, tv->name, strlen(thread_name_flow_rec)) == 0)
                 FR_num++;
-
-            tv = tv->next;
         }
     }
     SCMutexUnlock(&tv_root_lock);