diff --git a/core/include_internal/ten_runtime/app/msg_interface/common.h b/core/include_internal/ten_runtime/app/msg_interface/common.h index e0fd3ffcc0..77d525ff89 100644 --- a/core/include_internal/ten_runtime/app/msg_interface/common.h +++ b/core/include_internal/ten_runtime/app/msg_interface/common.h @@ -18,9 +18,9 @@ typedef struct ten_engine_t ten_engine_t; TEN_RUNTIME_PRIVATE_API void ten_app_push_to_in_msgs_queue( ten_app_t *self, ten_shared_ptr_t *msg); -TEN_RUNTIME_PRIVATE_API bool ten_app_handle_out_msg(ten_app_t *self, - ten_shared_ptr_t *msg, - ten_error_t *err); +TEN_RUNTIME_PRIVATE_API bool ten_app_dispatch_msg(ten_app_t *self, + ten_shared_ptr_t *msg, + ten_error_t *err); TEN_RUNTIME_PRIVATE_API bool ten_app_handle_in_msg(ten_app_t *self, ten_connection_t *connection, diff --git a/core/include_internal/ten_runtime/extension/extension.h b/core/include_internal/ten_runtime/extension/extension.h index 744b9d4af0..c2408ae5bd 100644 --- a/core/include_internal/ten_runtime/extension/extension.h +++ b/core/include_internal/ten_runtime/extension/extension.h @@ -249,7 +249,7 @@ TEN_RUNTIME_PRIVATE_API ten_path_in_t * ten_extension_get_cmd_return_path_from_itself(ten_extension_t *self, const char *cmd_id); -TEN_RUNTIME_PRIVATE_API bool ten_extension_handle_out_msg( +TEN_RUNTIME_PRIVATE_API bool ten_extension_dispatch_msg( ten_extension_t *extension, ten_shared_ptr_t *msg, ten_error_t *err); TEN_RUNTIME_PRIVATE_API ten_runloop_t *ten_extension_get_attached_runloop( diff --git a/core/include_internal/ten_runtime/extension_group/msg_interface/common.h b/core/include_internal/ten_runtime/extension_group/msg_interface/common.h index ddd948fee8..875fe27516 100644 --- a/core/include_internal/ten_runtime/extension_group/msg_interface/common.h +++ b/core/include_internal/ten_runtime/extension_group/msg_interface/common.h @@ -15,5 +15,5 @@ typedef struct ten_extension_group_t ten_extension_group_t; -TEN_RUNTIME_PRIVATE_API bool ten_extension_group_handle_out_msg( +TEN_RUNTIME_PRIVATE_API bool ten_extension_group_dispatch_msg( ten_extension_group_t *self, ten_shared_ptr_t *msg, ten_error_t *err); diff --git a/core/src/ten_runtime/app/msg_interface/common.c b/core/src/ten_runtime/app/msg_interface/common.c index 6bd658c27d..a5ee826ee0 100644 --- a/core/src/ten_runtime/app/msg_interface/common.c +++ b/core/src/ten_runtime/app/msg_interface/common.c @@ -274,8 +274,8 @@ static bool ten_app_handle_stop_graph_cmd(ten_app_t *self, return true; } -bool ten_app_handle_out_msg(ten_app_t *self, ten_shared_ptr_t *msg, - ten_error_t *err) { +bool ten_app_dispatch_msg(ten_app_t *self, ten_shared_ptr_t *msg, + ten_error_t *err) { // The source of the out message is the current app. ten_msg_set_src_to_app(msg, self); diff --git a/core/src/ten_runtime/extension/extension.c b/core/src/ten_runtime/extension/extension.c index 350769f219..35045f8f49 100644 --- a/core/src/ten_runtime/extension/extension.c +++ b/core/src/ten_runtime/extension/extension.c @@ -611,17 +611,8 @@ static TEN_EXTENSION_DETERMINE_OUT_MSGS_RESULT ten_extension_determine_out_msgs( } } -static void ten_extension_dispatch_msg(ten_extension_t *self, - ten_shared_ptr_t *msg) { - TEN_ASSERT(self && ten_extension_check_integrity(self, true) && msg && - ten_msg_check_integrity(msg), - "Should not happen."); - - ten_extension_thread_dispatch_msg(self->extension_thread, msg); -} - -bool ten_extension_handle_out_msg(ten_extension_t *self, ten_shared_ptr_t *msg, - ten_error_t *err) { +bool ten_extension_dispatch_msg(ten_extension_t *self, ten_shared_ptr_t *msg, + ten_error_t *err) { TEN_ASSERT(self && ten_extension_check_integrity(self, true), "Should not happen."); TEN_ASSERT(msg && ten_msg_check_integrity(msg), "Should not happen."); @@ -739,7 +730,7 @@ bool ten_extension_handle_out_msg(ten_extension_t *self, ten_shared_ptr_t *msg, TEN_ASSERT(result_msg && ten_msg_check_integrity(result_msg), "Invalid argument."); - ten_extension_dispatch_msg(self, result_msg); + ten_extension_thread_dispatch_msg(self->extension_thread, msg); } done: diff --git a/core/src/ten_runtime/extension_group/msg_interface/common.c b/core/src/ten_runtime/extension_group/msg_interface/common.c index f7cf7e97a0..735a0ef3b6 100644 --- a/core/src/ten_runtime/extension_group/msg_interface/common.c +++ b/core/src/ten_runtime/extension_group/msg_interface/common.c @@ -14,10 +14,8 @@ #include "include_internal/ten_runtime/extension_group/extension_group.h" #include "include_internal/ten_runtime/msg/msg.h" -// =-=-= handle_out_msg 统一成 dispatch_msg? -bool ten_extension_group_handle_out_msg(ten_extension_group_t *self, - ten_shared_ptr_t *msg, - ten_error_t *err) { +bool ten_extension_group_dispatch_msg(ten_extension_group_t *self, + ten_shared_ptr_t *msg, ten_error_t *err) { ten_msg_set_src_to_extension_group(msg, self); ten_loc_t *dest_loc = ten_msg_get_first_dest_loc(msg); diff --git a/core/src/ten_runtime/ten_env/internal/return.c b/core/src/ten_runtime/ten_env/internal/return.c index ee17f13b74..5c302c916c 100644 --- a/core/src/ten_runtime/ten_env/internal/return.c +++ b/core/src/ten_runtime/ten_env/internal/return.c @@ -57,7 +57,7 @@ static bool ten_env_return_result_internal( TEN_ASSERT(extension && ten_extension_check_integrity(extension, true), "Invalid use of extension %p.", extension); - result = ten_extension_handle_out_msg(extension, result_cmd, err); + result = ten_extension_dispatch_msg(extension, result_cmd, err); break; } @@ -68,9 +68,8 @@ static bool ten_env_return_result_internal( ten_extension_group_check_integrity(extension_group, true), "Invalid use of extension_group %p.", extension_group); - // =-=-= result = - ten_extension_group_handle_out_msg(extension_group, result_cmd, err); + ten_extension_group_dispatch_msg(extension_group, result_cmd, err); break; } diff --git a/core/src/ten_runtime/ten_env/internal/send.c b/core/src/ten_runtime/ten_env/internal/send.c index f948faa0c7..5438a60960 100644 --- a/core/src/ten_runtime/ten_env/internal/send.c +++ b/core/src/ten_runtime/ten_env/internal/send.c @@ -103,7 +103,7 @@ static bool ten_send_msg_internal( ten_extension_t *extension = ten_env_get_attached_extension(self); TEN_ASSERT(extension, "Should not happen."); - result = ten_extension_handle_out_msg(extension, msg, err); + result = ten_extension_dispatch_msg(extension, msg, err); break; } @@ -112,8 +112,7 @@ static bool ten_send_msg_internal( ten_env_get_attached_extension_group(self); TEN_ASSERT(extension_group, "Should not happen."); - // =-=-= - result = ten_extension_group_handle_out_msg(extension_group, msg, err); + result = ten_extension_group_dispatch_msg(extension_group, msg, err); break; } @@ -129,7 +128,7 @@ static bool ten_send_msg_internal( ten_app_t *app = ten_env_get_attached_app(self); TEN_ASSERT(app, "Should not happen."); - result = ten_app_handle_out_msg(app, msg, err); + result = ten_app_dispatch_msg(app, msg, err); break; }