]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3794: stream: store thread local flow control pointer in global
authorShanmugam S (shanms) <shanms@cisco.com>
Tue, 4 Apr 2023 08:08:02 +0000 (08:08 +0000)
committerShanmugam S (shanms) <shanms@cisco.com>
Tue, 4 Apr 2023 08:08:02 +0000 (08:08 +0000)
Merge in SNORT/snort3 from ~KBHANDAN/snort3:crash_dump_flow_control to master

Squashed commit of the following:

commit e6dd384b6ba178393dcf1bd56721b7243646a05f
Author: Kaushal Bhandankar <kbhandan@cisco.com>
Date:   Tue Apr 4 10:35:32 2023 +0530

    stream: store thread local flow control pointer in global

src/stream/base/stream_base.cc

index a3bf9d99b1b1e5791c25386c0e12f23b4e5bfd84..15abe460f4c82a954767f239ce0a0eb104f569c7 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 #include <functional>
+#include <mutex>
 
 #include "detection/ips_context.h"
 #include "flow/expect_cache.h"
@@ -51,6 +52,9 @@ using namespace snort;
 THREAD_LOCAL ProfileStats s5PerfStats;
 THREAD_LOCAL FlowControl* flow_con = nullptr;
 
+std::vector<FlowControl *> crash_dump_flow_control;
+static std::mutex crash_dump_flow_control_mutex;
+
 static BaseStats g_stats;
 THREAD_LOCAL BaseStats stream_base_stats;
 THREAD_LOCAL PegCount current_flows_prev;
@@ -218,6 +222,11 @@ void StreamBase::tinit()
 
     // this is temp added to suppress the compiler error only
     flow_con = new FlowControl(config.flow_cache_cfg);
+
+    std::unique_lock<std::mutex> flow_control_lock(crash_dump_flow_control_mutex);
+    crash_dump_flow_control.push_back(flow_con);
+    flow_control_lock.unlock();
+
     InspectSsnFunc f;
 
     StreamHAManager::tinit();