From: Michael Altizer (mialtize) Date: Tue, 11 Sep 2018 22:52:05 +0000 (-0400) Subject: Merge pull request #1356 in SNORT/snort3 from offload_latency to master X-Git-Tag: 3.0.0-248~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c905885c997b2858a7959b4a464dddc5f8a1efd9;p=thirdparty%2Fsnort3.git Merge pull request #1356 in SNORT/snort3 from offload_latency to master Squashed commit of the following: commit dd1db94f1e3c8a74f64c7f08912507b358646123 Author: Carter Waxman Date: Fri Sep 7 12:37:37 2018 -0400 Latency: added cleanup for RegexOffload threads --- diff --git a/src/detection/regex_offload.cc b/src/detection/regex_offload.cc index 9163ff529..57986b52b 100644 --- a/src/detection/regex_offload.cc +++ b/src/detection/regex_offload.cc @@ -34,6 +34,8 @@ #include #include "main/snort_config.h" +#include "latency/packet_latency.h" +#include "latency/rule_latency.h" #include "fp_detect.h" #include "ips_context.h" @@ -112,6 +114,14 @@ void RegexOffload::worker(RegexRequest* req) req->offload = false; } + tterm(); +} + +void RegexOffload::tterm() +{ + // FIXIT-M break this overcoupling. In reality we shouldn't be evaluating latency in offload. + PacketLatency::tterm(); + RuleLatency::tterm(); } void RegexOffload::put(unsigned id, snort::Packet* p) diff --git a/src/detection/regex_offload.h b/src/detection/regex_offload.h index e12d21942..198071569 100644 --- a/src/detection/regex_offload.h +++ b/src/detection/regex_offload.h @@ -62,6 +62,7 @@ public: private: static void worker(RegexRequest*); + static void tterm(); private: std::list busy; diff --git a/src/latency/packet_latency.cc b/src/latency/packet_latency.cc index ace4331be..1aeec41e2 100644 --- a/src/latency/packet_latency.cc +++ b/src/latency/packet_latency.cc @@ -204,6 +204,7 @@ static struct SnortLogHandler : public EventHandler static THREAD_LOCAL Impl<>* impl = nullptr; +// FIXIT-L this should probably be put in a tinit static inline Impl<>& get_impl() { if ( !impl ) diff --git a/src/latency/rule_latency.cc b/src/latency/rule_latency.cc index 234635da0..c70b2472f 100644 --- a/src/latency/rule_latency.cc +++ b/src/latency/rule_latency.cc @@ -323,6 +323,7 @@ static struct SnortLogHandler : public EventHandler static THREAD_LOCAL Impl<>* impl = nullptr; +// FIXIT-L this should probably be put in a tinit static inline Impl<>& get_impl() { if ( !impl )