From 2a063bd7fc4604d0edb07a4f6113287b97bddbe5 Mon Sep 17 00:00:00 2001 From: "Michael Altizer (mialtize)" Date: Fri, 31 May 2019 11:20:34 -0400 Subject: [PATCH] Merge pull request #1617 in SNORT/snort3 from ~BBANTWAL/snort3:offload_memstats_fix to master Squashed commit of the following: commit f10682ce0c9e034bef3d3a42a3e2fcebe0c94691 Author: Bhagya Tholpady Date: Fri May 24 17:06:38 2019 -0400 flow: check if flow is actually deleted before updating memstats --- src/flow/flow_cache.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/flow/flow_cache.cc b/src/flow/flow_cache.cc index c3dae9dbc..0ed2f33b0 100644 --- a/src/flow/flow_cache.cc +++ b/src/flow/flow_cache.cc @@ -158,8 +158,15 @@ int FlowCache::remove(Flow* flow) if ( flow->next ) unlink_uni(flow); - memory::MemoryCap::update_deallocations(config.cap_weight); - return hash_table->remove(flow->key); + bool deleted = hash_table->remove(flow->key); + + // FIXIT-M This check is added for offload case where both Flow::reset + // and Flow::retire try remove the flow from hash. Flow::reset should + // just mark the flow as pending instead of trying to remove it. + if ( deleted ) + memory::MemoryCap::update_deallocations(config.cap_weight); + + return deleted; } int FlowCache::retire(Flow* flow) -- 2.47.3