From: Suyeon Hwang Date: Tue, 19 Oct 2021 07:59:05 +0000 (+0900) Subject: Use tidl synchronous connect for tts_prepare_sync() X-Git-Tag: submit/tizen/20211028.101609~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5e8f4d71153b32a16a749799708ec54316af967;p=platform%2Fcore%2Fuifw%2Ftts.git Use tidl synchronous connect for tts_prepare_sync() Change-Id: I58652521adaf9bf4faee8225e5998d28bb707a5d Signed-off-by: Suyeon Hwang --- diff --git a/client/tts_tidl.c b/client/tts_tidl.c index 5937899b..8bf0f064 100644 --- a/client/tts_tidl.c +++ b/client/tts_tidl.c @@ -416,20 +416,25 @@ int tts_tidl_request_hello(int uid) return TTS_ERROR_NONE; } -static int __wait_tidl_connection(tts_tidl_info_s* info) -{ - int cnt = 0; - while (false == info->connected && MAX_CONNECT_CHECK > cnt) { - ecore_main_loop_iterate(); - usleep(50000); - cnt++; +static int __request_tidl_connect_sync(tts_tidl_info_s* info) { + int ret = rpc_port_proxy_tts_connect_sync(info->rpc_h); + SLOG(LOG_INFO, TAG_TTSC, "[INFO] Request connection to stub. ret(%d)", ret); + if (RPC_PORT_ERROR_NONE == ret) { + return TTS_ERROR_NONE; } - if (false == info->connected) { + if (0 != rpc_port_proxy_tts_destroy(info->rpc_h)) { + SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to disconnect"); return TTS_ERROR_OPERATION_FAILED; } - return TTS_ERROR_NONE; + info->rpc_h = __create_rpc_port(info->uid, info->engine_app_id); + if (NULL == info->rpc_h) { + SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create proxy"); + return TTS_ERROR_OPERATION_FAILED; + } + + return TTS_ERROR_OPERATION_FAILED; } int tts_tidl_request_hello_sync(int uid) @@ -450,9 +455,9 @@ int tts_tidl_request_hello_sync(int uid) if (!info->connected) { SLOG(LOG_WARN, TAG_TTSC, "[WARNNING] Stub is not Connected. Try to connect.."); - rpc_port_proxy_tts_connect(info->rpc_h); - if (TTS_ERROR_NONE != __wait_tidl_connection(info)) { - SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connect"); + int ret = __request_tidl_connect_sync(info); + if (TTS_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connect. ret(%d)", ret); return TTS_ERROR_OPERATION_FAILED; }