Delay quitting ecore main loop for 30s 91/303991/1
authorwn.jang <wn.jang@samsung.com>
Wed, 3 Jan 2024 05:46:23 +0000 (14:46 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Tue, 9 Jan 2024 02:43:21 +0000 (02:43 +0000)
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

index 2c1428254dd9f49bd2c5688aa1f04d5c9f1b197b..7c86be7839db7c989346e8464bda70baf0102788 100644 (file)
@@ -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;