From 731d7e69bc8c62ad11c078f0ccc4c5ba837b871c Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 28 Sep 2022 09:55:08 +0900 Subject: [PATCH] Retry when prepare_sync is failed Change-Id: I9a96cd1254fefd746a76e6f8bb1fe2bba255293e --- client/vc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/vc.c b/client/vc.c index 2f18575..d0d19db 100644 --- a/client/vc.c +++ b/client/vc.c @@ -697,13 +697,22 @@ int vc_prepare_sync(void) /* check state */ RETVM_IF(state != VC_STATE_INITIALIZED, VC_ERROR_INVALID_STATE, TAG_VCC, "[ERROR] Invalid State: Current state(%d) is not 'Initialized'", state); - ret = vc_tidl_request_hello_sync(); + ret = -1; + int cnt = 0; + while (VC_CONNECTION_RETRY_COUNT > cnt) { + ret= vc_tidl_request_hello_sync(); + if (VC_ERROR_NONE == ret) + break; + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello_sync and retry, ret(%d)", ret); + usleep(100000); + cnt++; + } if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello_sync, ret(%d)", ret); return ret; } - int cnt = 0; + cnt = 0; while (EINA_TRUE == __vc_connect_daemon(NULL) && VC_CONNECTION_RETRY_COUNT > cnt) { cnt++; } -- 2.34.1