🐞 fix(TSG_MASTER_UNLOAD): 卸载插件时,释放INIT阶段申请的所有内存
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8...3.10)
|
||||
|
||||
project(sapp_ctest)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 2.8...3.10)
|
||||
|
||||
add_definitions(-fPIC)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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/)
|
||||
|
||||
Reference in New Issue
Block a user