From b66ac64f73961db802ca5360e0c0dc9b7e69343f Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 27 Dec 2019 14:05:35 +0900 Subject: [PATCH] Make sure to wait long enough when service is reset Change-Id: I3034354245dfa14519f056ac5c71588038d91376 --- client/ma.c | 15 ++++++++++----- client/ma_dbus.c | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/ma.c b/client/ma.c index 0138730..47f479a 100644 --- a/client/ma.c +++ b/client/ma.c @@ -387,7 +387,7 @@ static void __start_prepare_func() /* Send hello */ while (0 != ret) { - if (retry_count == 10) { + if (retry_count == 100) { MA_SLOGE("[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE return; } @@ -397,12 +397,14 @@ static void __start_prepare_func() MA_SLOGD("Success to request hello. retry count(%d)", retry_count); break; } else { + usleep(300000); retry_count++; } } ret = -1; retry_count = 0; + while (0 != ret) { if (retry_count == 10) { MA_SLOGE("[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE @@ -413,6 +415,7 @@ static void __start_prepare_func() MA_SLOGD("Success to connect daemon. retry count(%d)", retry_count); break; } else { + usleep(10000); retry_count++; } } @@ -631,10 +634,6 @@ int __ma_cb_error(int reason, char* msg) ma_client_set_client_state(g_ma, MA_STATE_INITIALIZED); __ma_notify_state_changed((void*)g_ma); - - if (0 != ma_prepare()) { - MA_SLOGE("[ERROR] Fail to prepare"); - } } MA_SLOGE("[ERROR] Error reason(%d), msg(%s)", reason, msg); @@ -642,6 +641,12 @@ int __ma_cb_error(int reason, char* msg) ma_client_set_error(g_ma, reason); __ma_notify_error((void*)g_ma); + if (MA_ERROR_SERVICE_RESET == reason) { + if (0 != ma_prepare()) { + MA_SLOGE("[ERROR] Fail to prepare"); + } + } + return MA_ERROR_NONE; } diff --git a/client/ma_dbus.c b/client/ma_dbus.c index 271d4fb..e834dd4 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -535,7 +535,7 @@ int ma_dbus_request_hello() result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, -1, &err); if (dbus_error_is_set(&err)) { - MA_SLOGD("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } -- 2.34.1