aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorFábio Depin <fabio@seti.com.br>2025-06-24 10:07:20 -0300
committerGitHub <noreply@github.com>2025-06-24 15:07:20 +0200
commit8987a2c184b6768b577a4a83e69aacb2bf69856c (patch)
tree805da6fb5cd4da1e9a28f0bf5b2da7ad6351f47c /example
parentc216c09e2ced56bbd28583e42b28dd02ae885518 (diff)
Fix logic: reset stats once per thread after clearing all flow roots (#2905)
Call ndpi_stats_reset() once per thread instead of once per flow root Moved ndpi_stats_reset() outside the loop that destroys ndpi_flows_root[] to avoid redundant resets. The stats structure is shared per thread and should only be reset once after all roots are cleared.
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 4357606fb..f52958e69 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -4935,9 +4935,8 @@ static void ndpi_process_packet(u_char *args,
for(i=0; i<ndpi_thread_info[thread_id].workflow->prefs.num_roots; i++) {
ndpi_tdestroy(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], ndpi_flow_info_freer);
ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i] = NULL;
-
- ndpi_stats_reset(&ndpi_thread_info[thread_id].workflow->stats);
}
+ ndpi_stats_reset(&ndpi_thread_info[thread_id].workflow->stats);
if(!quiet_mode)
printf("\n-------------------------------------------\n\n");