Add timer to stop sending hello message
[platform/core/uifw/tts.git] / client / tts.c
index b7176fc..1c78f22 100644 (file)
@@ -49,6 +49,7 @@ static char* g_language = NULL;
 static int g_voice_type = -1;
 
 static int g_speed = -1;
+static int g_retry_cnt = 0;
 
 /* for checking engine update */
 static pkgmgr_client* g_pkgmgr = NULL;
@@ -906,6 +907,13 @@ static Eina_Bool __send_hello(void *data)
                SLOG(LOG_ERROR, TAG_TTSC, "@@@ Send Hello");
        }
 
+       g_retry_cnt++;
+       if (TTS_HELLO_RETRY_COUNT == g_retry_cnt) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Stop to send hello, retry count reaches the limit");
+               g_retry_cnt = 0;
+               return EINA_FALSE;
+       }
+
        if (!g_hello_timer) {
                SLOG(LOG_ERROR, TAG_TTSC, "@@@ Call checking Hello timer callback");
                g_hello_timer = ecore_timer_add(0.5, __send_hello, tts);
@@ -940,6 +948,7 @@ int tts_prepare(tts_h tts)
 
        if (NULL == g_hello_timer) {
                SLOG(LOG_ERROR, TAG_TTSC, "@@@ Call checking Hello timer callback");
+               g_retry_cnt = 0;
                ecore_thread_main_loop_begin();
                ecore_timer_add(0.0, __send_hello, (void*)tts);
                ecore_thread_main_loop_end();