From: Joel Cornett Date: Tue, 5 Apr 2016 19:48:56 +0000 (-0400) Subject: changed preemptive pruning to work iteratively X-Git-Tag: 3.0.0-233~474^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bbe83afe2be52e4ea9d2f1ba4b7c7e18dd83c18;p=thirdparty%2Fsnort3.git changed preemptive pruning to work iteratively --- diff --git a/src/flow/flow_control.cc b/src/flow/flow_control.cc index 5e3d08617..0129ef915 100644 --- a/src/flow/flow_control.cc +++ b/src/flow/flow_control.cc @@ -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(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; + } } //-------------------------------------------------------------------------