Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary on_xxx_done check for addon #672

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ napi_value ten_nodejs_ten_env_on_configure_done(napi_env env,

ten_error_t err;
ten_error_init(&err);
bool rc = false;

if (ten_env_bridge->c_ten_env->attach_to == TEN_ENV_ATTACH_TO_ADDON) {
rc = ten_env_on_configure_done(ten_env_bridge->c_ten_env, &err);
} else {
rc = ten_env_proxy_notify_async(ten_env_bridge->c_ten_env_proxy,
ten_env_proxy_notify_on_configure_done,
NULL, &err);
}

bool rc = ten_env_proxy_notify_async(ten_env_bridge->c_ten_env_proxy,
ten_env_proxy_notify_on_configure_done,
NULL, &err);
if (!rc) {
TEN_LOGD("TEN/JS failed to on_configure_done.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ napi_value ten_nodejs_ten_env_on_start_done(napi_env env,

ten_error_t err;
ten_error_init(&err);
bool rc = false;

if (ten_env_bridge->c_ten_env->attach_to == TEN_ENV_ATTACH_TO_ADDON) {
rc = ten_env_on_start_done(ten_env_bridge->c_ten_env, &err);
} else {
rc = ten_env_proxy_notify_async(ten_env_bridge->c_ten_env_proxy,
ten_env_proxy_notify_on_start_done, NULL,
&err);
}

bool rc = ten_env_proxy_notify_async(ten_env_bridge->c_ten_env_proxy,
ten_env_proxy_notify_on_start_done, NULL,
&err);
if (!rc) {
TEN_LOGD("TEN/JS failed to on_start_done.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ napi_value ten_nodejs_ten_env_on_stop_done(napi_env env,

ten_error_t err;
ten_error_init(&err);
bool rc = false;

if (ten_env_bridge->c_ten_env->attach_to == TEN_ENV_ATTACH_TO_ADDON) {
rc = ten_env_on_stop_done(ten_env_bridge->c_ten_env, &err);
} else {
rc = ten_env_proxy_notify_async(ten_env_bridge->c_ten_env_proxy,
ten_env_proxy_notify_on_stop_done, NULL,
&err);
}

bool rc =
ten_env_proxy_notify_async(ten_env_bridge->c_ten_env_proxy,
ten_env_proxy_notify_on_stop_done, NULL, &err);
if (!rc) {
TEN_LOGD("TEN/JS failed to on_stop_done.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,15 @@ PyObject *ten_py_ten_env_on_configure_done(PyObject *self, PyObject *args) {
ten_error_t err;
ten_error_init(&err);

bool rc = true;

if (py_ten_env->c_ten_env->attach_to == TEN_ENV_ATTACH_TO_ADDON) {
rc = ten_env_on_configure_done(py_ten_env->c_ten_env, &err);
} else {
if (!py_ten_env->c_ten_env_proxy) {
return ten_py_raise_py_value_error_exception(
"ten_env.on_configure_done() failed because ten_env_proxy is "
"invalid.");
}

rc = ten_env_proxy_notify_async(py_ten_env->c_ten_env_proxy,
ten_env_proxy_notify_on_configure_done,
NULL, &err);
if (!py_ten_env->c_ten_env_proxy) {
return ten_py_raise_py_value_error_exception(
"ten_env.on_configure_done() failed because ten_env_proxy is "
"invalid.");
}

bool rc = ten_env_proxy_notify_async(py_ten_env->c_ten_env_proxy,
ten_env_proxy_notify_on_configure_done,
NULL, &err);
if (!rc) {
ten_error_deinit(&err);
return ten_py_raise_py_runtime_error_exception(
Expand Down
2 changes: 1 addition & 1 deletion docs