Make sure to wait long enough when service is reset 04/221104/3
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Dec 2019 05:05:35 +0000 (14:05 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Dec 2019 06:26:28 +0000 (15:26 +0900)
Change-Id: I3034354245dfa14519f056ac5c71588038d91376

client/ma.c
client/ma_dbus.c

index 013873050e9a377486f613242c656f0c1c760dbc..47f479ab24c6ac49eaafbaa07a7f83262703d48d 100644 (file)
@@ -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;
 }
 
index 271d4fbd4d18d5dc08bd238074583b526adc32df..e834dd42d484226a912ca3811484a5b2922edba8 100644 (file)
@@ -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);
        }