]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
changed preemptive pruning to work iteratively
authorJoel Cornett <joel.cornett@gmail.com>
Tue, 5 Apr 2016 19:48:56 +0000 (15:48 -0400)
committerJoel Cornett <joel.cornett@gmail.com>
Tue, 5 Apr 2016 19:48:56 +0000 (15:48 -0400)
src/flow/flow_control.cc

index 5e3d08617517e1acb762d3d6e48b01c0f6618275..0129ef915cbe790b7529899bdea4df22844ab9fd 100644 (file)
@@ -298,15 +298,15 @@ void FlowControl::timeout_flows(uint32_t flowCount, time_t cur_time)
 
 void FlowControl::preemptive_cleanup(const Packet* p)
 {
-    if ( !memory::MemoryCap::over_threshold() )
-        return;
-
     DebugFormat(DEBUG_FLOW, "doing preemptive cleanup for packet of type %d",
             static_cast<int>(p->type()));
 
-    // FIXIT-H J we want to associate this prune with an appropriate prune reason
-    // FIXIT-L J do we want to accumulate preemptive prune counts?
-    prune_flows(p->type(), p);
+    // FIXIT-L J is there a possibility of this looping forever?
+    while ( memory::MemoryCap::over_threshold() )
+    {
+        if ( !prune_one(PruneReason::PREEMPTIVE, true) )
+            break;
+    }
 }
 
 //-------------------------------------------------------------------------