bugfix: function name

This commit is contained in:
luwenpeng
2024-09-25 12:03:45 +08:00
parent b3ddebf770
commit eccd6e102d
2 changed files with 22 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ extern "C"
struct session_manager; struct session_manager;
int session_manager_new_packet_exdata_index(struct session_manager *sess_mgr, const char *name, exdata_free *func, void *arg); int session_manager_new_session_exdata_index(struct session_manager *sess_mgr, const char *name, exdata_free *func, void *arg);
typedef void on_session_callback(struct session *sess, struct packet *pkt, void *args); typedef void on_session_callback(struct session *sess, struct packet *pkt, void *args);
typedef void on_tcp_stream_callback(struct session *sess, const char *tcp_payload, uint32_t tcp_payload_len, void *args); typedef void on_tcp_stream_callback(struct session *sess, const char *tcp_payload, uint32_t tcp_payload_len, void *args);

View File

@@ -307,6 +307,10 @@ void session_manager_free(struct session_manager *sess_mgr)
struct session_manager *session_manager_new(struct packet_manager *pkt_mgr, struct mq_schema *mq_schema, const char *toml_file) struct session_manager *session_manager_new(struct packet_manager *pkt_mgr, struct mq_schema *mq_schema, const char *toml_file)
{ {
assert(pkt_mgr);
assert(mq_schema);
assert(toml_file);
uint16_t thread_num; uint16_t thread_num;
uint64_t instance_id; uint64_t instance_id;
uint64_t now_ms = clock_get_real_time_ms(); uint64_t now_ms = clock_get_real_time_ms();
@@ -360,29 +364,42 @@ error_out:
return NULL; return NULL;
} }
int session_manager_new_packet_exdata_index(struct session_manager *sess_mgr, const char *name, exdata_free *func, void *arg) int session_manager_new_session_exdata_index(struct session_manager *sess_mgr, const char *name, exdata_free *func, void *arg)
{ {
assert(sess_mgr);
assert(name);
return exdata_schema_new_index(sess_mgr->schema->exdata, name, func, arg); return exdata_schema_new_index(sess_mgr->schema->exdata, name, func, arg);
} }
int session_manager_subscribe_tcp(struct session_manager *sess_mgr, on_session_callback *cb, void *args) int session_manager_subscribe_tcp(struct session_manager *sess_mgr, on_session_callback *cb, void *args)
{ {
assert(sess_mgr);
assert(cb);
return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_tcp, (on_msg_cb_func *)(void *)cb, args); return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_tcp, (on_msg_cb_func *)(void *)cb, args);
} }
int session_manager_subscribe_udp(struct session_manager *sess_mgr, on_session_callback *cb, void *args) int session_manager_subscribe_udp(struct session_manager *sess_mgr, on_session_callback *cb, void *args)
{ {
assert(sess_mgr);
assert(cb);
return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_udp, (on_msg_cb_func *)(void *)cb, args); return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_udp, (on_msg_cb_func *)(void *)cb, args);
} }
int session_manager_subscribe_control_packet(struct session_manager *sess_mgr, on_session_callback *cb, void *args) int session_manager_subscribe_control_packet(struct session_manager *sess_mgr, on_session_callback *cb, void *args)
{ {
assert(sess_mgr);
assert(cb);
return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_ctrl_pkt, (on_msg_cb_func *)(void *)cb, args); return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_ctrl_pkt, (on_msg_cb_func *)(void *)cb, args);
} }
int session_manager_subscribe_tcp_stream(struct session_manager *sess_mgr, on_tcp_stream_callback *cb, void *args) int session_manager_subscribe_tcp_stream(struct session_manager *sess_mgr, on_tcp_stream_callback *cb, void *args)
{ {
assert(sess_mgr); assert(sess_mgr);
assert(cb);
return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_tcp_stream, (on_msg_cb_func *)(void *)cb, args); return mq_schema_subscribe(sess_mgr->schema->mq, sess_mgr->schema->topic_id_tcp_stream, (on_msg_cb_func *)(void *)cb, args);
} }
@@ -393,6 +410,8 @@ int session_manager_subscribe_tcp_stream(struct session_manager *sess_mgr, on_tc
struct stellar_module *session_manager_module_on_init(struct stellar_module_manager *mod_mgr) struct stellar_module *session_manager_module_on_init(struct stellar_module_manager *mod_mgr)
{ {
assert(mod_mgr);
struct stellar_module *pkt_mgr_mod = stellar_module_manager_get_module(mod_mgr, "packet_manager_module"); struct stellar_module *pkt_mgr_mod = stellar_module_manager_get_module(mod_mgr, "packet_manager_module");
struct packet_manager *pkt_mgr = stellar_module_get_ctx(pkt_mgr_mod); struct packet_manager *pkt_mgr = stellar_module_get_ctx(pkt_mgr_mod);
struct mq_schema *mq_schema = stellar_module_manager_get_mq_schema(mod_mgr); struct mq_schema *mq_schema = stellar_module_manager_get_mq_schema(mod_mgr);
@@ -404,7 +423,7 @@ struct stellar_module *session_manager_module_on_init(struct stellar_module_mana
return NULL; return NULL;
} }
struct stellar_module *sess_mgr_mod = stellar_module_new("session_manager_module", sess_mgr); struct stellar_module *sess_mgr_mod = stellar_module_new("session_manager_module", NULL);
if (sess_mgr_mod == NULL) if (sess_mgr_mod == NULL)
{ {
SESSION_MANAGER_LOG_ERROR("failed to create session_manager_module"); SESSION_MANAGER_LOG_ERROR("failed to create session_manager_module");