Delay quitting ecore main loop for 30s 55/303655/2
authorwn.jang <wn.jang@samsung.com>
Wed, 3 Jan 2024 05:46:23 +0000 (14:46 +0900)
committerwn.jang <wn.jang@samsung.com>
Wed, 3 Jan 2024 05:46:55 +0000 (14:46 +0900)
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

server/ttsd_server.c

index bf24c21a989c4a402ff2965e2b3a4360f717484d..19e263f06fda8d871b6f7afa18735fffec601f3c 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) \
@@ -630,6 +631,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;
@@ -949,12 +951,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;