rename xxx_create() / xxx_destory() -> xxx_new() / xxx_free()

This commit is contained in:
luwenpeng
2024-03-08 14:20:36 +08:00
parent 9d562ffee6
commit c945931620
56 changed files with 330 additions and 330 deletions

View File

@@ -466,7 +466,7 @@ on opening update session
[*] session_set_key
[*] session_set_key_dir
[*] session_set_type
[*] session_set_create_time
[*] session_set_new_time
[*] session_set_state
on packet update session
@@ -603,7 +603,7 @@ static inline void session_manager_update_session_base(struct session_manager *m
{
session_set_type(sess, SESSION_TYPE_TCP);
}
session_set_create_time(sess, timestamp_get_sec());
session_set_new_time(sess, timestamp_get_sec());
}
static inline void session_manager_update_session_packet(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir)
@@ -1029,7 +1029,7 @@ static inline void session_manager_evicte_session(struct session_manager *mgr, s
* Public API
******************************************************************************/
struct session_manager *session_manager_create(struct session_manager_config *config)
struct session_manager *session_manager_new(struct session_manager_config *config)
{
if (session_manager_check_config(config))
{
@@ -1043,49 +1043,49 @@ struct session_manager *session_manager_create(struct session_manager_config *co
}
memcpy(&mgr->config, config, sizeof(struct session_manager_config));
mgr->sess_pool = session_pool_create(mgr->config.max_tcp_session_num + mgr->config.max_udp_session_num);
mgr->sess_pool = session_pool_new(mgr->config.max_tcp_session_num + mgr->config.max_udp_session_num);
if (mgr->sess_pool == NULL)
{
goto error;
}
mgr->tcp_sess_table = session_table_create();
mgr->tcp_sess_table = session_table_new();
if (mgr->tcp_sess_table == NULL)
{
goto error;
}
mgr->udp_sess_table = session_table_create();
mgr->udp_sess_table = session_table_new();
if (mgr->udp_sess_table == NULL)
{
goto error;
}
mgr->sess_timer = session_timer_create();
mgr->sess_timer = session_timer_new();
if (mgr->sess_timer == NULL)
{
goto error;
}
mgr->sess_evicted_queue = session_queue_create();
mgr->sess_evicted_queue = session_queue_new();
if (mgr->sess_evicted_queue == NULL)
{
goto error;
}
mgr->sess_toclosed_queue = session_queue_create();
mgr->sess_toclosed_queue = session_queue_new();
if (mgr->sess_toclosed_queue == NULL)
{
goto error;
}
mgr->tcp_dupkt_filter = dupkt_filter_create(mgr->config.tcp_dupkt_filter_enable, mgr->config.tcp_dupkt_filter_capacity, mgr->config.tcp_dupkt_filter_error_rate, mgr->config.tcp_dupkt_filter_timeout);
mgr->tcp_dupkt_filter = dupkt_filter_new(mgr->config.tcp_dupkt_filter_enable, mgr->config.tcp_dupkt_filter_capacity, mgr->config.tcp_dupkt_filter_error_rate, mgr->config.tcp_dupkt_filter_timeout);
if (mgr->tcp_dupkt_filter == NULL)
{
goto error;
}
mgr->udp_eviction_filter = eviction_filter_create(mgr->config.udp_eviction_filter_enable, mgr->config.udp_eviction_filter_capacity, mgr->config.udp_eviction_filter_error_rate, mgr->config.udp_eviction_filter_timeout);
mgr->udp_eviction_filter = eviction_filter_new(mgr->config.udp_eviction_filter_enable, mgr->config.udp_eviction_filter_capacity, mgr->config.udp_eviction_filter_error_rate, mgr->config.udp_eviction_filter_timeout);
if (mgr->udp_eviction_filter == NULL)
{
goto error;
@@ -1094,11 +1094,11 @@ struct session_manager *session_manager_create(struct session_manager_config *co
return mgr;
error:
session_manager_destroy(mgr);
session_manager_free(mgr);
return NULL;
}
void session_manager_destroy(struct session_manager *mgr)
void session_manager_free(struct session_manager *mgr)
{
struct session *sess;
if (mgr)
@@ -1126,14 +1126,14 @@ void session_manager_destroy(struct session_manager *mgr)
session_manager_free_session(mgr, sess);
}
eviction_filter_destroy(mgr->udp_eviction_filter);
dupkt_filter_destroy(mgr->tcp_dupkt_filter);
session_queue_destroy(mgr->sess_toclosed_queue);
session_queue_destroy(mgr->sess_evicted_queue);
session_timer_destroy(mgr->sess_timer);
session_table_destroy(mgr->udp_sess_table);
session_table_destroy(mgr->tcp_sess_table);
session_pool_destroy(mgr->sess_pool);
eviction_filter_free(mgr->udp_eviction_filter);
dupkt_filter_free(mgr->tcp_dupkt_filter);
session_queue_free(mgr->sess_toclosed_queue);
session_queue_free(mgr->sess_evicted_queue);
session_timer_free(mgr->sess_timer);
session_table_free(mgr->udp_sess_table);
session_table_free(mgr->tcp_sess_table);
session_pool_free(mgr->sess_pool);
free(mgr);
mgr = NULL;
}