diff --git a/CMakeLists.txt b/CMakeLists.txt index f59b2a1..a9a7f01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8...3.10) set(lib_name tsg_master) project(${lib_name}) diff --git a/ctest/CMakeLists.txt b/ctest/CMakeLists.txt index c784609..5f482e9 100644 --- a/ctest/CMakeLists.txt +++ b/ctest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8...3.10) project(sapp_ctest) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7a9857e..d48f4a5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8...3.10) add_definitions(-fPIC) diff --git a/src/tsg_entry.cpp b/src/tsg_entry.cpp index 201997d..31dca52 100644 --- a/src/tsg_entry.cpp +++ b/src/tsg_entry.cpp @@ -35,6 +35,7 @@ #include "tsg_sync_state.h" #include "tsg_proxy.h" #include "tsg_bridge.h" +#include "uthash.h" #ifdef __cplusplus extern "C" @@ -540,6 +541,24 @@ static int l7_protocol_mapper_init(const char *conffile) return 1; } +static void free_l7_protocol_mapper() +{ + + struct l7_protocol *out=NULL, *tmp=NULL; + HASH_CLEAR(hh2, g_tsg_para.id_by_name); + HASH_ITER(hh1, g_tsg_para.name_by_id, out ,tmp) + { + if(out!=NULL) + { + HASH_DELETE(hh1, g_tsg_para.name_by_id, out); + free(out); + out=NULL; + } + } + + +} + static int srt_process_context_set_l7_protocol(struct session_runtime_process_context *srt_process_context, unsigned int app_id) { const char *l7_protocol_name=tsg_l7_protocol_id2name(app_id); @@ -2620,5 +2639,20 @@ extern "C" int TSG_MASTER_INIT() extern "C" int TSG_MASTER_UNLOAD() { + + + g_tsg_maat_feather=NULL; + + + tsg_sendlog_destroy(g_tsg_log_instance); + tsg_metric_destroy(); + + free_l7_protocol_mapper(); + + tsg_maat_rule_destroy(); + + tsg_gtp_signaling_hash_destroy(); + MESA_destroy_runtime_log_handle(g_tsg_para.logger); + g_tsg_para.logger = NULL; return 0; } diff --git a/src/tsg_entry.h b/src/tsg_entry.h index 03780c8..cf1fd88 100644 --- a/src/tsg_entry.h +++ b/src/tsg_entry.h @@ -174,7 +174,7 @@ int tsg_metric_init(const char *conffile, void *logger); void tsg_metric_destroy(void); int tsg_gtp_signaling_hash_init(const char* conffile, void *logger); - +void tsg_gtp_signaling_hash_destroy(); char *session_l4_protocol_label_update(const struct streaminfo *a_stream); int session_application_full_path_update(const struct streaminfo *a_stream, char *app_full_path, int app_full_path_len); diff --git a/src/tsg_gtp_signaling.cpp b/src/tsg_gtp_signaling.cpp index c39865f..50bf3a7 100644 --- a/src/tsg_gtp_signaling.cpp +++ b/src/tsg_gtp_signaling.cpp @@ -222,6 +222,13 @@ int session_runtine_attribute_get_umts_user_info(const struct streaminfo *a_stre return 0; } +void tsg_gtp_signaling_hash_destroy() +{ + if(g_gtp_signaling_hash_handle == NULL)return; + MESA_htable_destroy(g_gtp_signaling_hash_handle, free_gtp_signaling_field); + g_gtp_signaling_hash_handle=NULL; +} + int tsg_gtp_signaling_hash_init(const char* conffile, void *logger) { MESA_load_profile_int_def(conffile, "GTP_SIGNALING", "HASH_TIMEOUT", &g_tsg_para.hash_timeout, 300); diff --git a/src/tsg_rule.cpp b/src/tsg_rule.cpp index 1c43ae7..f0f2f30 100644 --- a/src/tsg_rule.cpp +++ b/src/tsg_rule.cpp @@ -1979,6 +1979,13 @@ struct maat *init_maat_feather(const char* conffile, char* instance_name, char * return maat_new(opts, table_info); } +void tsg_maat_rule_destroy(void) +{ + maat_free(g_tsg_maat_feather); + MESA_destroy_runtime_log_handle(g_tsg_maat_rt_para.logger); + g_tsg_maat_rt_para.logger = NULL; +} + int tsg_maat_rule_init(const char* conffile) { int log_level=30; diff --git a/src/tsg_rule_internal.h b/src/tsg_rule_internal.h index 0b609d7..3011b5a 100644 --- a/src/tsg_rule_internal.h +++ b/src/tsg_rule_internal.h @@ -123,6 +123,7 @@ struct maat_compile }; int tsg_maat_rule_init(const char *conffile); +void tsg_maat_rule_destroy(void); void plugin_ex_data_gtp_c_free(struct umts_user_info *user_info); void plugin_ex_data_asn_number_free(struct asn_info *asn); diff --git a/test/src/CMakeLists.txt b/test/src/CMakeLists.txt index c30b649..2a25309 100644 --- a/test/src/CMakeLists.txt +++ b/test/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8...3.10) include_directories(${CMAKE_SOURCE_DIR}/inc) include_directories(/opt/MESA/include/MESA/)