From 76796a6c3de98c350c982dde3556d037aa736d66 Mon Sep 17 00:00:00 2001 From: yangwei Date: Thu, 19 Sep 2024 15:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=88=20style(stellar=20core):=20remove?= =?UTF-8?q?=20useless=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/mq/test/gtest_mq_main.cpp | 41 +++------------------------------ infra/stellar_core.c | 10 +++----- infra/stellar_core.h | 16 ------------- 3 files changed, 6 insertions(+), 61 deletions(-) delete mode 100644 infra/stellar_core.h diff --git a/infra/mq/test/gtest_mq_main.cpp b/infra/mq/test/gtest_mq_main.cpp index 7995c3a..3f33737 100644 --- a/infra/mq/test/gtest_mq_main.cpp +++ b/infra/mq/test/gtest_mq_main.cpp @@ -6,41 +6,6 @@ #define TOPIC_NAME_MAX 512 -#if 0 -void whitebox_test_plugin_manager_intrisic_metadata(struct stellar *st, struct plugin_manager_schema *plug_mgr) -{ - SCOPED_TRACE("whitebox test intrisic metadata"); - - EXPECT_TRUE(plug_mgr!=NULL); - - EXPECT_EQ(plug_mgr->st, st); - - //load spec null - EXPECT_TRUE(plug_mgr->plugin_load_specs_array==NULL); - - //session exdata schema null - EXPECT_TRUE(plug_mgr->exdata_schema!=NULL); - - //stellar mq schema null - EXPECT_TRUE(plug_mgr->stellar_mq_schema_array==NULL); - - //registered plugin array null - EXPECT_TRUE(plug_mgr->registered_polling_plugin_array==NULL); - EXPECT_TRUE(plug_mgr->registered_packet_plugin_array==NULL); - - EXPECT_TRUE(plug_mgr->per_thread_data!=NULL); - int thread_num=stellar_get_worker_thread_num(st); - for(int i=0; iper_thread_data[i].exdata_array==NULL); - EXPECT_TRUE(plug_mgr->per_thread_data[i].dealth_letter_queue==NULL); - for(int j=0; jper_thread_data[i].priority_mq[j]==NULL); - } -} - -#endif - /******************************************* * TEST MQ SCHEMA * *******************************************/ @@ -226,7 +191,7 @@ static void test_mq_on_packet_in_out(int topic_id, void *msg, void *plugin_env) return; } -TEST(plugin_manager, basic_pub_sub) { +TEST(mq_runtime, basic_pub_sub) { struct mq_schema *s = mq_schema_new(); EXPECT_TRUE(s!=NULL); @@ -446,7 +411,7 @@ static void overlimit_pub_on_packet(struct packet *pkt, void *plugin_env) } //TODO: test case mq for overlimit -TEST(plugin_manager, packet_plugins_pub_overlimit) { +TEST(mq_runtime, packet_plugins_pub_overlimit) { struct stellar st={0}; struct plugin_manager_schema *plug_mgr = plugin_manager_init(&st, NULL, MAX_MSG_PER_STAGE); @@ -587,7 +552,7 @@ static void test_session_mq_priority_plugin_2_on_msg(int topic_id, const void *m return; } -TEST(plugin_manager, test_session_mq_priority) { +TEST(mq_runtime, test_session_mq_priority) { struct stellar st={0}; struct session_plugin_env env; diff --git a/infra/stellar_core.c b/infra/stellar_core.c index 0c2a1f4..136c200 100644 --- a/infra/stellar_core.c +++ b/infra/stellar_core.c @@ -8,17 +8,19 @@ #include #include +#include "stellar/stellar.h" #include "stellar/module_manager.h" #include "utils.h" #include "packet_io.h" #include "log_private.h" #include "stellar_stat.h" -#include "stellar_core.h" #include "packet_private.h" #include "session_private.h" #include "session_manager.h" + + #define CORE_LOG_FATAL(format, ...) STELLAR_LOG_FATAL(__thread_local_logger, "core", format, ##__VA_ARGS__) #define CORE_LOG_ERROR(format, ...) STELLAR_LOG_ERROR(__thread_local_logger, "core", format, ##__VA_ARGS__) #define CORE_LOG_DEBUG(format, ...) STELLAR_LOG_DEBUG(__thread_local_logger, "core", format, ##__VA_ARGS__) @@ -189,7 +191,6 @@ static void *worker_thread(void *arg) defraged_pkt = NULL; pkt = &packets[i]; - //plugin_manager_on_packet_input(plug_mgr, pkt); if (packet_is_fragment(pkt)) { defraged_pkt = ip_reassembly_packet(ip_reass, pkt, now_ms); @@ -200,7 +201,6 @@ static void *worker_thread(void *arg) else { pkt = defraged_pkt; - //plugin_manager_on_packet_input(plug_mgr, defraged_pkt); } } @@ -226,12 +226,9 @@ static void *worker_thread(void *arg) fast_path: if (pkt == defraged_pkt) { - //plugin_manager_on_packet_output(plug_mgr, defraged_pkt); - //plugin_manager_on_packet_output(plug_mgr, &packets[i]); } else { - //plugin_manager_on_packet_output(plug_mgr, pkt); } if (sess) @@ -278,7 +275,6 @@ static void *worker_thread(void *arg) idle_tasks: clean_session(sess_mgr, now_ms); ip_reassembly_expire(ip_reass, now_ms); - //plugin_manager_on_polling(plug_mgr); stellar_stat_merge(runtime->stat, &thr_stat, thr_idx, now_ms); if (nr_pkt_received == 0) diff --git a/infra/stellar_core.h b/infra/stellar_core.h deleted file mode 100644 index c460d78..0000000 --- a/infra/stellar_core.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include "stellar/stellar.h" - -// TODO fix plugin manager, delete this function -struct plugin_manager_schema *stellar_get_plugin_manager(const struct stellar *st); -void stellar_set_plugin_manger(struct stellar *st, struct plugin_manager_schema *plug_mgr); - -#ifdef __cplusplus -} -#endif