]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow recycler: unix socket support
authorVictor Julien <victor@inliniac.net>
Thu, 1 May 2014 10:50:02 +0000 (12:50 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 28 Jul 2014 13:47:44 +0000 (15:47 +0200)
Support starting and shutting down the flow recycler thread in the
unix socket runmode.

src/runmode-unix-socket.c

index 03d7790315e4dc26190ddc293915c99335a8a8e2..ec53b3f6fffdd65f552503882f79b30b3d12223a 100644 (file)
@@ -286,15 +286,24 @@ TmEcode UnixSocketPcapFilesCheck(void *data)
             SCFree(this->currentfile);
         }
         this->currentfile = NULL;
-        TmThreadKillThreadsFamily(TVT_MGMT);
-        TmThreadClearThreadsFamily(TVT_MGMT);
+
+        /* handle graceful shutdown of the flow engine, it's helper
+         * threads and the packet threads */
+        FlowKillFlowManagerThread();
         TmThreadDisableThreadsWithTMS(TM_FLAG_RECEIVE_TM | TM_FLAG_DECODE_TM);
         FlowForceReassembly();
         TmThreadKillThreadsFamily(TVT_PPT);
         TmThreadClearThreadsFamily(TVT_PPT);
+        FlowKillFlowRecyclerThread();
         RunModeShutDown();
+
+        /* kill remaining mgt threads */
+        TmThreadKillThreadsFamily(TVT_MGMT);
+        TmThreadClearThreadsFamily(TVT_MGMT);
         SCPerfReleaseResources();
-        /* thread killed, we can run non thread-safe shutdown functions */
+
+        /* mgt and ppt threads killed, we can run non thread-safe
+         * shutdown functions */
         FlowShutdown();
         HostCleanup();
         StreamTcpFreeConfig(STREAM_VERBOSE);
@@ -332,6 +341,7 @@ TmEcode UnixSocketPcapFilesCheck(void *data)
         RunModeInitializeOutputs();
         RunModeDispatch(RUNMODE_PCAP_FILE, NULL, this->de_ctx);
         FlowManagerThreadSpawn();
+        FlowRecyclerThreadSpawn();
         SCPerfSpawnThreads();
         /* Un-pause all the paused threads */
         TmThreadContinueThreads();