From 1bde2a876eb8e1a6e3de7fc6695b8ea3bd3db90b Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 3 Jan 2024 14:46:23 +0900 Subject: [PATCH] Delay quitting ecore main loop for 30s While the tts engine is terminating for 100ms, if the tts client try to connect to the engine, the tts client is connected to the engine, which will be terminated. And tts client can't request to launch tts engine by rpc port. Change-Id: I8ac258d9aa26877ef19205278245b84506a1f5b9 (cherry picked from commit 19ea1a2069eb8e28a2e11070828ab15efb9fd3d9) --- server/ttsd_server.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 2c142825..7c86be78 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -27,6 +27,7 @@ #define CLIENT_CLEAN_UP_TIME 500 +#define CLIENT_PRESENCE_CHECK_TIME 30 /* for checking time */ #define TIME_DIFF(start, end) \ @@ -595,6 +596,7 @@ static Eina_Bool __cleanup_client(void *data) return EINA_FALSE; } + ecore_timer_interval_set(g_check_client_timer, CLIENT_CLEAN_UP_TIME); SLOG(LOG_DEBUG, tts_tag(), "@@@"); return EINA_TRUE; @@ -906,12 +908,12 @@ int ttsd_server_finalize(unsigned int uid) /* unload engine, if ref count of client is 0 */ if (0 == ttsd_data_get_client_count()) { - if (NULL == g_quit_loop_timer) { - SLOG(LOG_DEBUG, tts_tag(), "[Server] Quit main loop"); - g_quit_loop_timer = ecore_timer_add(0, __quit_ecore_loop, NULL); - } else { - SLOG(LOG_WARN, tts_tag(), "[Server] Already called __quit_ecore_loop"); + SLOG(LOG_INFO, tts_tag(), "[Server] Delay quitting ecore main loop for %d seconds.", CLIENT_PRESENCE_CHECK_TIME); + if (NULL != g_check_client_timer) { + SLOG(LOG_INFO, tts_tag(), "[Server] Delete check_client_timer"); + ecore_timer_del(g_check_client_timer); } + g_check_client_timer = ecore_timer_add(CLIENT_PRESENCE_CHECK_TIME, __cleanup_client, NULL); } return TTSD_ERROR_NONE; -- 2.34.1