]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow-recycler: speed up flow-recycler shutdown
authorVictor Julien <victor@inliniac.net>
Thu, 22 May 2014 10:53:51 +0000 (12:53 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 28 Jul 2014 13:47:45 +0000 (15:47 +0200)
Thread was killed by the generic TmThreadKillThreads instead of
the FlowKillFlowRecyclerThread. The latter wakes the thread up, so
that shutdown is quite a bit faster.

src/flow-manager.c
src/suricata.c

index d175f02bb48f66faf0155a1ffedb3507043fff5b..bea4b6b35169db97563b7a934f691a1b0e7263e7 100644 (file)
@@ -769,6 +769,8 @@ void FlowKillFlowRecyclerThread(void)
             TmThreadsSetFlag(tv, THV_KILL);
             TmThreadsSetFlag(tv, THV_DEINIT);
 
+            SCCtrlCondSignal(&flow_recycler_ctrl_cond);
+
             /* be sure it has shut down */
             while (!TmThreadsCheckFlag(tv, THV_CLOSED)) {
                 usleep(100);
index ebbea361f25c7493985c464b6bfc7ff2adec14bd..9be6671abd6c5070252ed290326eb6fad974f7d2 100644 (file)
@@ -2402,11 +2402,16 @@ int main(int argc, char **argv)
         BUG_ON(global_de_ctx == NULL);
     }
 
+    /* before TmThreadKillThreads, as otherwise that kills it
+     * but more slowly */
+    if (suri.run_mode != RUNMODE_UNIX_SOCKET) {
+        FlowKillFlowRecyclerThread();
+    }
+
     TmThreadKillThreads();
 
     if (suri.run_mode != RUNMODE_UNIX_SOCKET) {
         SCPerfReleaseResources();
-        FlowKillFlowRecyclerThread();
         FlowShutdown();
         StreamTcpFreeConfig(STREAM_VERBOSE);
     }