Added libnDPI global context init/deinit used for cache mgmt.

* support for adding *.ndpiconf for nDPI config tests
 * all other configs should have the suffix *.conf
 * fixed nDPI malloc/free wrapper set (was already too late set)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2024-10-21 15:06:19 +02:00
parent 8c5ee1f7bb
commit ae36f8df6c
585 changed files with 1824 additions and 1768 deletions

View File

@@ -1649,6 +1649,13 @@ int main(int argc, char ** argv)
return 1;
}
#ifdef ENABLE_MEMORY_STATUS
set_ndpi_malloc(ndpi_malloc_wrapper);
set_ndpi_free(ndpi_free_wrapper);
set_ndpi_flow_malloc(NULL);
set_ndpi_flow_free(NULL);
#endif
init_logging("nDPId-test");
log_app_info();
@@ -1743,6 +1750,12 @@ int main(int argc, char ** argv)
distributor_un_sockfd = -1;
distributor_in_sockfd = -1;
global_context = ndpi_global_init();
if (global_context == NULL)
{
logger_early(1, "Could not initialize libnDPI global context.");
}
if (setup_remote_descriptors(MAX_REMOTE_DESCRIPTORS) != 0)
{
return 1;
@@ -1797,6 +1810,12 @@ int main(int argc, char ** argv)
logger(0, "%s", "All worker threads terminated..");
free_reader_threads();
if (global_context != NULL)
{
ndpi_global_deinit(global_context);
}
global_context = NULL;
if (THREADS_RETURNED_ERROR() != 0)
{
char const * which_thread = "Unknown";