Add timer to stop sending hello message 29/224429/2
authorsooyeon.kim <sooyeon.kim@samsung.com>
Mon, 10 Feb 2020 12:01:45 +0000 (21:01 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Mon, 10 Feb 2020 12:02:32 +0000 (21:02 +0900)
Change-Id: Ic86480822ab2bd4c34a9db4fee88bbfcf6a03b5b
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
client/tts.c
common/tts_defs.h

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();
index 91901f6..11e981a 100644 (file)
@@ -97,6 +97,7 @@ extern "C" {
 #define TTS_RETRY_COUNT                        5
 #define TTS_RETRY_MIN_COUNT            2
 #define TTS_CONNECTION_RETRY_COUNT     10
+#define TTS_HELLO_RETRY_COUNT   40 // 500 ms * 40 = 20 sec
 
 #define TTS_SPEED_MIN          1
 #define TTS_SPEED_NORMAL       8