]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1399 in SNORT/snort3 from ring_o_stress to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Fri, 26 Oct 2018 18:26:25 +0000 (14:26 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Fri, 26 Oct 2018 18:26:25 +0000 (14:26 -0400)
Squashed commit of the following:

commit f7f5d5982a329066406bc46b450a53068fd4bcd0
Author: Russ Combs <rucombs@cisco.com>
Date:   Mon Oct 22 11:50:40 2018 -0400

    main: size analyzer notification ring appropriately

src/main.cc
src/main/analyzer.cc
src/main/analyzer.h
src/main/analyzer_command.h

index 2cf57b7943a026d246786f8243a913618e6c4264..cbe6bc0a9ccca0ab4e1a9628b0fe577399351979 100644 (file)
@@ -887,7 +887,10 @@ static void snort_main()
     max_pigs = ThreadConfig::get_instance_max();
     assert(max_pigs > 0);
 
-    pig_poke = new Ring<unsigned>(max_pigs+2);
+    // maximum number of state change notifications per pig
+    constexpr unsigned max_grunts = static_cast<unsigned>(Analyzer::State::NUM_STATES);
+
+    pig_poke = new Ring<unsigned>((max_pigs*max_grunts)+1);
     pigs = new Pig[max_pigs];
 
     for (unsigned idx = 0; idx < max_pigs; idx++)
index 567836e42974157c25d58803a93ece90922430d6..253248a2192aa052b193a88a70e54d442171450f 100644 (file)
@@ -66,6 +66,7 @@ const char* Analyzer::get_state_string()
     case State::RUNNING:     return "RUNNING";
     case State::PAUSED:      return "PAUSED";
     case State::STOPPED:     return "STOPPED";
+    default: assert(false);
     }
 
     return "UNKNOWN";
index 8e251cc42a9350d0b06f0e7bafaef3733d992649..c7fee76369a651bb7c56a170ae1335f739d9f7eb 100644 (file)
@@ -46,7 +46,8 @@ public:
         STARTED,
         RUNNING,
         PAUSED,
-        STOPPED
+        STOPPED,
+        NUM_STATES
     };
     Analyzer(unsigned id, const char* source);
 
index a069291b218c8865bddb44593356c7190fb72853..bd990270eb32df98d180a27f9d9f22f222fabb9a 100644 (file)
@@ -113,7 +113,8 @@ public:
 
 namespace snort
 {
-SO_PUBLIC void main_broadcast_command(AnalyzerCommand* ac, bool from_shell = false);   // From main.cc
+// from main.cc
+SO_PUBLIC void main_broadcast_command(AnalyzerCommand* ac, bool from_shell = false);
 }
 
 #endif