diff --git a/core/include/ten_runtime/addon/extension/extension.h b/core/include/ten_runtime/addon/extension/extension.h index f0ac09f5f..489bc10ef 100644 --- a/core/include/ten_runtime/addon/extension/extension.h +++ b/core/include/ten_runtime/addon/extension/extension.h @@ -25,12 +25,12 @@ TEN_RUNTIME_API ten_addon_host_t *ten_addon_register_extension( TEN_RUNTIME_API ten_addon_t *ten_addon_unregister_extension(const char *name); -TEN_RUNTIME_API bool ten_addon_create_extension_async( +TEN_RUNTIME_API bool ten_addon_create_extension( ten_env_t *ten_env, const char *addon_name, const char *instance_name, ten_env_addon_on_create_instance_async_cb_t cb, void *user_data, ten_error_t *err); -TEN_RUNTIME_API bool ten_addon_destroy_extension_async( +TEN_RUNTIME_API bool ten_addon_destroy_extension( ten_env_t *ten_env, ten_extension_t *extension, ten_env_addon_on_destroy_instance_async_cb_t cb, void *user_data, ten_error_t *err); diff --git a/core/include/ten_runtime/binding/cpp/internal/ten_env.h b/core/include/ten_runtime/binding/cpp/internal/ten_env.h index a6c17eac4..f1bb0cdf9 100644 --- a/core/include/ten_runtime/binding/cpp/internal/ten_env.h +++ b/core/include/ten_runtime/binding/cpp/internal/ten_env.h @@ -894,13 +894,13 @@ class ten_env_t { addon_create_extension_async_cb_t &&cb, error_t *err) { if (cb == nullptr) { - return ten_addon_create_extension_async( + return ten_addon_create_extension( c_ten_env, addon_name, instance_name, nullptr, nullptr, err != nullptr ? err->get_internal_representation() : nullptr); } else { auto *cb_ptr = new addon_create_extension_async_cb_t(std::move(cb)); - return ten_addon_create_extension_async( + return ten_addon_create_extension( c_ten_env, addon_name, instance_name, proxy_addon_create_extension_async_cb, cb_ptr, err != nullptr ? err->get_internal_representation() : nullptr); diff --git a/core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h b/core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h index 618b1aac2..787b5d8c6 100644 --- a/core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h +++ b/core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h @@ -68,13 +68,13 @@ inline bool ten_env_t::addon_destroy_extension_async( ten::extension_t *extension, addon_destroy_extension_async_cb_t &&cb, error_t *err) { if (cb == nullptr) { - return ten_addon_destroy_extension_async( + return ten_addon_destroy_extension( c_ten_env, extension->get_c_extension(), nullptr, nullptr, err != nullptr ? err->get_internal_representation() : nullptr); } else { auto *cb_ptr = new addon_destroy_extension_async_cb_t(std::move(cb)); - return ten_addon_destroy_extension_async( + return ten_addon_destroy_extension( c_ten_env, extension->get_c_extension(), proxy_addon_destroy_extension_async_cb, cb_ptr, err != nullptr ? err->get_internal_representation() : nullptr); diff --git a/core/include_internal/ten_runtime/addon/extension_group/extension_group.h b/core/include_internal/ten_runtime/addon/extension_group/extension_group.h index 86bea44f5..e806356e2 100644 --- a/core/include_internal/ten_runtime/addon/extension_group/extension_group.h +++ b/core/include_internal/ten_runtime/addon/extension_group/extension_group.h @@ -17,10 +17,10 @@ typedef struct ten_addon_store_t ten_addon_store_t; TEN_RUNTIME_PRIVATE_API ten_addon_store_t *ten_extension_group_get_store(void); -TEN_RUNTIME_API bool ten_addon_extension_group_create( +TEN_RUNTIME_API bool ten_addon_create_extension_group( ten_env_t *ten_env, const char *addon_name, const char *instance_name, ten_env_addon_on_create_instance_async_cb_t cb, void *user_data); -TEN_RUNTIME_API bool ten_addon_extension_group_destroy( +TEN_RUNTIME_API bool ten_addon_destroy_extension_group( ten_env_t *ten_env, ten_extension_group_t *extension_group, ten_env_addon_on_destroy_instance_async_cb_t cb, void *user_data); diff --git a/core/include_internal/ten_runtime/addon/protocol/protocol.h b/core/include_internal/ten_runtime/addon/protocol/protocol.h index 2e9fc5a10..c377b00ca 100644 --- a/core/include_internal/ten_runtime/addon/protocol/protocol.h +++ b/core/include_internal/ten_runtime/addon/protocol/protocol.h @@ -27,11 +27,16 @@ typedef struct ten_addon_create_protocol_info_t { void *user_data; } ten_addon_create_protocol_info_t; -TEN_RUNTIME_PRIVATE_API bool ten_addon_create_protocol_async( +TEN_RUNTIME_PRIVATE_API bool ten_addon_create_protocol_with_uri( ten_env_t *ten_env, const char *uri, TEN_PROTOCOL_ROLE role, ten_env_addon_on_create_protocol_async_cb_t cb, void *user_data, ten_error_t *err); +TEN_RUNTIME_PRIVATE_API bool ten_addon_create_protocol( + ten_env_t *ten_env, const char *addon_name, const char *instance_name, + TEN_PROTOCOL_ROLE role, ten_env_addon_on_create_protocol_async_cb_t cb, + void *user_data, ten_error_t *err); + TEN_RUNTIME_PRIVATE_API ten_addon_store_t *ten_protocol_get_store(void); TEN_RUNTIME_PRIVATE_API ten_addon_host_t *ten_addon_protocol_find( diff --git a/core/src/ten_runtime/addon/extension/extension.c b/core/src/ten_runtime/addon/extension/extension.c index 129d5fda5..c2886bff8 100644 --- a/core/src/ten_runtime/addon/extension/extension.c +++ b/core/src/ten_runtime/addon/extension/extension.c @@ -26,10 +26,10 @@ static ten_addon_store_t g_extension_store = { ten_addon_store_t *ten_extension_get_store(void) { return &g_extension_store; } -bool ten_addon_create_extension_async( - ten_env_t *ten_env, const char *addon_name, const char *instance_name, - ten_env_addon_on_create_instance_async_cb_t cb, void *cb_data, - TEN_UNUSED ten_error_t *err) { +bool ten_addon_create_extension(ten_env_t *ten_env, const char *addon_name, + const char *instance_name, + ten_env_addon_on_create_instance_async_cb_t cb, + void *cb_data, TEN_UNUSED ten_error_t *err) { TEN_ASSERT(addon_name && instance_name, "Should not happen."); TEN_ASSERT(ten_env, "Invalid argument."); @@ -70,7 +70,7 @@ bool ten_addon_create_extension_async( } } -bool ten_addon_destroy_extension_async( +bool ten_addon_destroy_extension( ten_env_t *ten_env, ten_extension_t *extension, ten_env_addon_on_destroy_instance_async_cb_t cb, void *cb_data, TEN_UNUSED ten_error_t *err) { diff --git a/core/src/ten_runtime/addon/extension_group/extension_group.c b/core/src/ten_runtime/addon/extension_group/extension_group.c index 980498c45..6963004a3 100644 --- a/core/src/ten_runtime/addon/extension_group/extension_group.c +++ b/core/src/ten_runtime/addon/extension_group/extension_group.c @@ -50,7 +50,7 @@ ten_addon_t *ten_addon_unregister_extension_group(const char *name) { return ten_addon_unregister(ten_extension_group_get_store(), name); } -bool ten_addon_extension_group_create( +bool ten_addon_create_extension_group( ten_env_t *ten_env, const char *addon_name, const char *instance_name, ten_env_addon_on_create_instance_async_cb_t cb, void *user_data) { TEN_ASSERT(addon_name && instance_name, "Should not happen."); @@ -74,7 +74,7 @@ bool ten_addon_extension_group_create( user_data); } -bool ten_addon_extension_group_destroy( +bool ten_addon_destroy_extension_group( ten_env_t *ten_env, ten_extension_group_t *extension_group, ten_env_addon_on_destroy_instance_async_cb_t cb, void *cb_data) { TEN_ASSERT(ten_env && ten_env_check_integrity(ten_env, true) && cb, diff --git a/core/src/ten_runtime/addon/protocol/protocol.c b/core/src/ten_runtime/addon/protocol/protocol.c index 1d571a8ac..18523dbf4 100644 --- a/core/src/ten_runtime/addon/protocol/protocol.c +++ b/core/src/ten_runtime/addon/protocol/protocol.c @@ -113,14 +113,19 @@ ten_addon_host_t *ten_addon_protocol_find(const char *protocol) { static ten_addon_create_protocol_info_t *ten_addon_create_protocol_info_create( const char *uri, TEN_PROTOCOL_ROLE role, ten_env_addon_on_create_protocol_async_cb_t cb, void *user_data) { - TEN_ASSERT(uri && role > TEN_PROTOCOL_ROLE_INVALID, "Should not happen."); + TEN_ASSERT(role > TEN_PROTOCOL_ROLE_INVALID, "Should not happen."); ten_addon_create_protocol_info_t *info = (ten_addon_create_protocol_info_t *)TEN_MALLOC( sizeof(ten_addon_create_protocol_info_t)); TEN_ASSERT(info, "Failed to allocate memory."); - ten_string_init_formatted(&info->uri, "%s", uri); + if (!uri || strlen(uri) == 0) { + ten_string_init(&info->uri); + } else { + ten_string_init_formatted(&info->uri, "%s", uri); + } + info->role = role; info->cb = cb; info->user_data = user_data; @@ -150,8 +155,11 @@ static void proxy_on_addon_protocol_created(ten_env_t *ten_env, void *instance, if (protocol) { ten_protocol_determine_default_property_value(protocol); - ten_string_set_formatted(&protocol->uri, "%s", - ten_string_get_raw_str(&info->uri)); + if (!ten_string_is_empty(&info->uri)) { + ten_string_set_formatted(&protocol->uri, "%s", + ten_string_get_raw_str(&info->uri)); + } + protocol->role = info->role; } @@ -162,7 +170,7 @@ static void proxy_on_addon_protocol_created(ten_env_t *ten_env, void *instance, ten_addon_create_protocol_info_destroy(info); } -bool ten_addon_create_protocol_async( +bool ten_addon_create_protocol_with_uri( ten_env_t *ten_env, const char *uri, TEN_PROTOCOL_ROLE role, ten_env_addon_on_create_protocol_async_cb_t cb, void *user_data, ten_error_t *err) { @@ -222,3 +230,47 @@ bool ten_addon_create_protocol_async( return true; } + +bool ten_addon_create_protocol(ten_env_t *ten_env, const char *addon_name, + const char *instance_name, + TEN_PROTOCOL_ROLE role, + ten_env_addon_on_create_protocol_async_cb_t cb, + void *user_data, ten_error_t *err) { + TEN_ASSERT(addon_name && instance_name, "Should not happen."); + TEN_ASSERT(role > TEN_PROTOCOL_ROLE_INVALID, "Should not happen."); + TEN_ASSERT(ten_env && ten_env_check_integrity(ten_env, true), + "Should not happen."); + + TEN_ENV_ATTACH_TO attach_to = ten_env_get_attach_to(ten_env); + if (attach_to != TEN_ENV_ATTACH_TO_APP && + attach_to != TEN_ENV_ATTACH_TO_ENGINE) { + TEN_LOGE("Invalid ten_env attach_to: %d", attach_to); + if (err) { + ten_error_set(err, TEN_ERRNO_INVALID_ARGUMENT, "Invalid ten_env."); + } + return false; + } + + TEN_LOGD("Loading protocol addon: %s", addon_name); + + ten_addon_create_protocol_info_t *info = + ten_addon_create_protocol_info_create(NULL, role, cb, user_data); + TEN_ASSERT(info, "Failed to allocate memory."); + + bool rc = ten_addon_create_instance_async( + ten_env, addon_name, instance_name, TEN_ADDON_TYPE_PROTOCOL, + proxy_on_addon_protocol_created, info); + + if (!rc) { + TEN_LOGE("Failed to create protocol for %s", addon_name); + ten_addon_create_protocol_info_destroy(info); + + if (err) { + ten_error_set(err, TEN_ERRNO_GENERIC, + "Failed to create protocol for addon: %s.", addon_name); + } + return false; + } + + return true; +} diff --git a/core/src/ten_runtime/app/ten_env/on_xxx.c b/core/src/ten_runtime/app/ten_env/on_xxx.c index d08e7545e..558216492 100644 --- a/core/src/ten_runtime/app/ten_env/on_xxx.c +++ b/core/src/ten_runtime/app/ten_env/on_xxx.c @@ -161,7 +161,7 @@ void ten_app_on_configure_done(ten_env_t *ten_env) { if (!ten_string_is_equal_c_str(&self->uri, TEN_STR_LOCALHOST)) { // Create the app listening endpoint protocol if specifying one. - rc = ten_addon_create_protocol_async( + rc = ten_addon_create_protocol_with_uri( self->ten_env, ten_string_get_raw_str(&self->uri), TEN_PROTOCOL_ROLE_LISTEN, ten_app_on_endpoint_protocol_created, NULL, &err); diff --git a/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_create_extension.c b/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_create_extension.c index 5ca12f9ee..7b001ff18 100644 --- a/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_create_extension.c +++ b/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_create_extension.c @@ -118,7 +118,7 @@ static void ten_env_proxy_notify_addon_create_extension(ten_env_t *ten_env, ten_error_t err; ten_error_init(&err); - bool rc = ten_addon_create_extension_async( + bool rc = ten_addon_create_extension( ten_env, ten_string_get_raw_str(&info->addon_name), ten_string_get_raw_str(&info->instance_name), proxy_addon_create_extension_done, info->callback_info, &err); diff --git a/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_destroy_extension.c b/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_destroy_extension.c index f7a7c248d..91bbbc19d 100644 --- a/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_destroy_extension.c +++ b/core/src/ten_runtime/binding/go/native/ten_env/ten_env_addon_destroy_extension.c @@ -92,9 +92,9 @@ static void ten_env_proxy_notify_addon_destroy_extension(ten_env_t *ten_env, ten_error_t err; ten_error_init(&err); - bool rc = ten_addon_destroy_extension_async( - ten_env, info->c_extension, proxy_addon_destroy_extension_done, info, - &err); + bool rc = ten_addon_destroy_extension(ten_env, info->c_extension, + proxy_addon_destroy_extension_done, + info, &err); TEN_ASSERT(rc, "Should not happen."); ten_error_deinit(&err); diff --git a/core/src/ten_runtime/engine/internal/remote_interface.c b/core/src/ten_runtime/engine/internal/remote_interface.c index 086811631..9ad8d4a42 100644 --- a/core/src/ten_runtime/engine/internal/remote_interface.c +++ b/core/src/ten_runtime/engine/internal/remote_interface.c @@ -255,7 +255,7 @@ static bool ten_engine_create_remote_async( ten_engine_on_protocol_created_info_create(on_remote_created_cb, cb_data); TEN_ASSERT(info, "Failed to allocate memory."); - bool rc = ten_addon_create_protocol_async( + bool rc = ten_addon_create_protocol_with_uri( self->ten_env, uri, TEN_PROTOCOL_ROLE_OUT_DEFAULT, ten_engine_on_remote_protocol_created, info, &err); if (!rc) { diff --git a/core/src/ten_runtime/extension_context/extension_context.c b/core/src/ten_runtime/extension_context/extension_context.c index 6057fc3b7..ee4a79d00 100644 --- a/core/src/ten_runtime/extension_context/extension_context.c +++ b/core/src/ten_runtime/extension_context/extension_context.c @@ -401,7 +401,7 @@ static void destroy_extension_group_by_addon( TEN_ASSERT(ten_env && ten_env_check_integrity(ten_env, true), "Should not happen."); - ten_addon_extension_group_destroy( + ten_addon_destroy_extension_group( ten_env, extension_group, ten_extension_context_on_extension_group_destroyed, NULL); } @@ -566,7 +566,7 @@ bool ten_extension_context_start_extension_group( // `app`. if (ten_string_is_equal(&extension_group_info->loc.app_uri, &self->engine->app->uri)) { - bool res = ten_addon_extension_group_create( + bool res = ten_addon_create_extension_group( ten_env, ten_string_get_raw_str( &extension_group_info->extension_group_addon_name), diff --git a/core/src/ten_runtime/extension_group/builtin/builtin_extension_group.c b/core/src/ten_runtime/extension_group/builtin/builtin_extension_group.c index 1133bc4d2..1b39c0e39 100644 --- a/core/src/ten_runtime/extension_group/builtin/builtin_extension_group.c +++ b/core/src/ten_runtime/extension_group/builtin/builtin_extension_group.c @@ -121,7 +121,7 @@ static void ten_builtin_extension_group_on_create_extensions( ten_string_t *extension_addon_name = &extension_name_info->addon_name; ten_string_t *extension_instance_name = &extension_name_info->instance_name; - bool res = ten_addon_create_extension_async( + bool res = ten_addon_create_extension( ten_env, ten_string_get_raw_str(extension_addon_name), ten_string_get_raw_str(extension_instance_name), (ten_env_addon_on_create_instance_async_cb_t) @@ -156,8 +156,8 @@ static void ten_builtin_extension_group_on_destroy_extensions( TEN_ASSERT(extension && ten_extension_check_integrity(extension, true), "Invalid argument."); - ten_addon_destroy_extension_async( - ten_env, extension, on_addon_destroy_instance_done, NULL, NULL); + ten_addon_destroy_extension(ten_env, extension, + on_addon_destroy_instance_done, NULL, NULL); } } diff --git a/core/src/ten_runtime/protocol/asynced/protocol_asynced.c b/core/src/ten_runtime/protocol/asynced/protocol_asynced.c index e010acc24..9f6f534d4 100644 --- a/core/src/ten_runtime/protocol/asynced/protocol_asynced.c +++ b/core/src/ten_runtime/protocol/asynced/protocol_asynced.c @@ -398,7 +398,7 @@ void ten_protocol_asynced_on_connected_async(ten_protocol_asynced_t *self, } static void ten_app_thread_on_client_protocol_created(ten_env_t *ten_env, - void *instance, + ten_protocol_t *instance, void *cb_data) { TEN_ASSERT(ten_env && ten_env_check_integrity(ten_env, true), "Should not happen."); @@ -415,7 +415,7 @@ static void ten_app_thread_on_client_protocol_created(ten_env_t *ten_env, ten_protocol_check_integrity(&listening_protocol->base, true), "Invalid argument."); - ten_protocol_asynced_t *protocol = instance; + ten_protocol_asynced_t *protocol = (ten_protocol_asynced_t *)instance; if (!protocol) { TEN_LOGE("Failed to create the protocol instance."); info->on_created(NULL, info); @@ -427,13 +427,6 @@ static void ten_app_thread_on_client_protocol_created(ten_env_t *ten_env, // object) might need to be migrated, so set the value to 'INIT' as the // default value is 'DONE'. Refer to 'ten_protocol_asynced_init()'. protocol->migration_state = TEN_CONNECTION_MIGRATION_STATE_INIT; - - // We can _not_ know whether the protocol role is - // 'TEN_PROTOCOL_ROLE_IN_INTERNAL' or 'TEN_PROTOCOL_ROLE_IN_EXTERNAL' until - // the message received from the protocol is processed. Refer to - // 'ten_connection_on_msgs()' and - // 'ten_connection_handle_command_from_external_client()'. - protocol->base.role = TEN_PROTOCOL_ROLE_IN_DEFAULT; protocol->base.on_accepted = listening_protocol->base.on_accepted; ten_protocol_attach_to_app_and_thread(&protocol->base, app); @@ -473,11 +466,22 @@ static void ten_protocol_asynced_on_client_accepted(void *self, void *info_) { ten_app_t *app = listening_base_protocol->attached_target.app; TEN_ASSERT(app && ten_app_check_integrity(app, true), "Should not happen."); - bool rc = ten_addon_create_instance_async( + ten_error_t err; + ten_error_init(&err); + + // We can _not_ know whether the protocol role is + // 'TEN_PROTOCOL_ROLE_IN_INTERNAL' or 'TEN_PROTOCOL_ROLE_IN_EXTERNAL' + // until the message received from the protocol is processed. Refer to + // 'ten_connection_on_msgs()' and + // 'ten_connection_handle_command_from_external_client()'. + bool rc = ten_addon_create_protocol( app->ten_env, ten_string_get_raw_str(&addon_host->name), - ten_string_get_raw_str(&addon_host->name), TEN_ADDON_TYPE_PROTOCOL, - ten_app_thread_on_client_protocol_created, info); - TEN_ASSERT(rc, "Should not happen."); + ten_string_get_raw_str(&addon_host->name), TEN_PROTOCOL_ROLE_IN_DEFAULT, + ten_app_thread_on_client_protocol_created, info, NULL); + TEN_ASSERT(rc, "Failed to create protocol, err: %s", + ten_error_errmsg(&err)); + + ten_error_deinit(&err); } // The task is completed, so delete a reference to the 'protocol' to reflect diff --git a/core/src/ten_runtime/protocol/integrated/protocol_integrated.c b/core/src/ten_runtime/protocol/integrated/protocol_integrated.c index e7c23ac35..4d18ea844 100644 --- a/core/src/ten_runtime/protocol/integrated/protocol_integrated.c +++ b/core/src/ten_runtime/protocol/integrated/protocol_integrated.c @@ -30,6 +30,7 @@ #include "ten_utils/io/runloop.h" #include "ten_utils/io/stream.h" #include "ten_utils/lib/alloc.h" +#include "ten_utils/lib/error.h" #include "ten_utils/lib/mutex.h" #include "ten_utils/lib/ref.h" #include "ten_utils/lib/smart_ptr.h" @@ -272,12 +273,12 @@ static void ten_protocol_integrated_set_stream(ten_protocol_integrated_t *self, } static void ten_app_thread_on_client_protocol_created(ten_env_t *ten_env, - void *instance, + ten_protocol_t *instance, void *cb_data) { TEN_ASSERT(ten_env && ten_env_check_integrity(ten_env, true), "Should not happen."); - ten_protocol_integrated_t *protocol = instance; + ten_protocol_integrated_t *protocol = (ten_protocol_integrated_t *)instance; TEN_ASSERT(protocol && ten_protocol_check_integrity(&protocol->base, true), "Should not happen."); @@ -304,13 +305,6 @@ static void ten_app_thread_on_client_protocol_created(ten_env_t *ten_env, new_communication_base_protocol->on_connected = listening_base_protocol->on_connected; - // We can _not_ know whether the protocol role is - // 'TEN_PROTOCOL_ROLE_IN_INTERNAL' or 'TEN_PROTOCOL_ROLE_IN_EXTERNAL' until - // the message received from the protocol is processed. Refer to - // 'ten_connection_on_msgs()' and - // 'ten_connection_handle_command_from_external_client()'. - new_communication_base_protocol->role = TEN_PROTOCOL_ROLE_IN_DEFAULT; - // Attach the newly created protocol to app first. ten_protocol_attach_to_app(new_communication_base_protocol, listening_base_protocol->attached_target.app); @@ -344,13 +338,23 @@ static void ten_protocol_integrated_on_client_accepted( ten_app_t *app = listening_base_protocol->attached_target.app; TEN_ASSERT(app && ten_app_check_integrity(app, true), "Should not happen."); - bool rc = ten_addon_create_instance_async( + ten_error_t err; + ten_error_init(&err); + + // We can _not_ know whether the protocol role is + // 'TEN_PROTOCOL_ROLE_IN_INTERNAL' or 'TEN_PROTOCOL_ROLE_IN_EXTERNAL' until + // the message received from the protocol is processed. Refer to + // 'ten_connection_on_msgs()' and + // 'ten_connection_handle_command_from_external_client()'. + bool rc = ten_addon_create_protocol( app->ten_env, ten_string_get_raw_str(&listening_base_protocol->addon_host->name), ten_string_get_raw_str(&listening_base_protocol->addon_host->name), - TEN_ADDON_TYPE_PROTOCOL, ten_app_thread_on_client_protocol_created, - stream); - TEN_ASSERT(rc, "Should not happen."); + TEN_PROTOCOL_ROLE_IN_DEFAULT, ten_app_thread_on_client_protocol_created, + stream, &err); + TEN_ASSERT(rc, "Failed to create protocol, err: %s", ten_error_errmsg(&err)); + + ten_error_deinit(&err); } static void ten_protocol_integrated_listen(ten_protocol_integrated_t *self,