【修改】整体功能测试过程中修改部分输出及BugFIX

This commit is contained in:
niubinghui
2024-08-19 14:54:43 +08:00
parent 4898a47663
commit cb4f940a35
3 changed files with 10 additions and 9 deletions

View File

@@ -529,7 +529,7 @@ int lua_mq_destory_topic(lua_State *state)
int lua_mq_subscribe_topic(lua_State *state) int lua_mq_subscribe_topic(lua_State *state)
{ {
/* 参数个数检查 */ /* 参数个数检查 */
if (lua_gettop(state) != 2) if (lua_gettop(state) != 4)
{ {
lua_settop(state, 0); lua_settop(state, 0);
return 0; return 0;
@@ -547,7 +547,7 @@ int lua_mq_subscribe_topic(lua_State *state)
int plugin_id = lua_tointeger(state, -1); int plugin_id = lua_tointeger(state, -1);
lua_pop(state, 1); lua_pop(state, 1);
int on_message_ref = luaL_ref(state, -1); int on_message_ref = luaL_ref(state, LUA_REGISTRYINDEX);
if (on_message_ref == LUA_REFNIL) if (on_message_ref == LUA_REFNIL)
{ {
lua_settop(state, 0); lua_settop(state, 0);

View File

@@ -383,9 +383,9 @@ struct lua_plugin_manage_schema *lua_plugin_manage_init(
} }
} }
} }
#ifdef LUAPLUGIN_BASIC_UNITTEST
debug_lua_plugin_manage_schema(new_schema); debug_lua_plugin_manage_schema(new_schema);
#endif
return new_schema; return new_schema;
} }

View File

@@ -79,7 +79,7 @@
* struct lua_plugin; * struct lua_plugin;
* struct lua_model; * struct lua_model;
* struct lua_plugin_manage_schema; * struct lua_plugin_manage_schema;
* *
* 08-14 * 08-14
* 新增message相关结构定义 * 新增message相关结构定义
* 1. 声明并定义结构 * 1. 声明并定义结构
@@ -286,7 +286,8 @@ struct lua_plugin
int ctx_new_ref; int ctx_new_ref;
/* context_free函数在状态机中的引用值 */ /* context_free函数在状态机中的引用值 */
int ctx_free_ref; int ctx_free_ref;
UT_array * sub_topic_array; /* 该插件中订阅的topic */
UT_array *sub_topic_array;
}; };
#define MODEL_MARK_INIT_DONE 0x0001 #define MODEL_MARK_INIT_DONE 0x0001
@@ -337,11 +338,11 @@ struct lua_plugin_manage_schema
int mq_count; int mq_count;
/* TODO: 创建的所有message topic id理论上应该是连续的, 可以考虑用hash数组, 寻址能更快 */ /* TODO: 创建的所有message topic id理论上应该是连续的, 可以考虑用hash数组, 寻址能更快 */
UT_array * message_mq_array; UT_array *message_mq_array;
}; };
struct lua_plugin * search_plugin_by_id(int plugin_id); struct lua_plugin *search_plugin_by_id(int plugin_id);
struct lua_message_mq * search_message_mq_by_id(int topic_id); struct lua_message_mq *search_message_mq_by_id(int topic_id);
#ifdef LUAPLUGIN_BASIC_UNITTEST #ifdef LUAPLUGIN_BASIC_UNITTEST
void debug_lua_state_stack(lua_State *state, int mod, const char *message); void debug_lua_state_stack(lua_State *state, int mod, const char *message);