From f234bc19a16e5e31b82ccc0485cc5dc06118d2e7 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 23 Jun 2022 21:52:38 +0000 Subject: [PATCH] node: stop IO on unref only if we own event loop Otherwise unrefing context stops its IO even when we use account manager, e.g. in desktop client. --- CHANGELOG.md | 2 +- node/src/module.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f8a72841..a8e64d690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ ### Fixes - set a default error if NDN does not provide an error - python: avoid exceptions when messages/contacts/chats are compared with `None` -- node: wait for the event loop to stop before destroying contexts #3431 +- node: wait for the event loop to stop before destroying contexts #3431 #3451 - emit configuration errors via event on failure #3433 - report configure and imex success/failure after freeing ongoing process #3442 diff --git a/node/src/module.c b/node/src/module.c index 66132983a..2d2f4beee 100644 --- a/node/src/module.c +++ b/node/src/module.c @@ -371,8 +371,8 @@ NAPI_METHOD(dcn_context_unref) { TRACE("Unrefing dc_context"); dcn_context->gc = 1; - dc_stop_io(dcn_context->dc_context); if (dcn_context->event_handler_thread != 0) { + dc_stop_io(dcn_context->dc_context); uv_thread_join(&dcn_context->event_handler_thread); dcn_context->event_handler_thread = 0; } @@ -2927,8 +2927,8 @@ NAPI_METHOD(dcn_accounts_unref) { TRACE("Unrefing dc_accounts"); dcn_accounts->gc = 1; - dc_accounts_stop_io(dcn_accounts->dc_accounts); if (dcn_accounts->event_handler_thread != 0) { + dc_accounts_stop_io(dcn_accounts->dc_accounts); uv_thread_join(&dcn_accounts->event_handler_thread); dcn_accounts->event_handler_thread = 0; }