return EINA_FALSE;
}
-static void __start_prepare_func()
+static Ecore_Timer* g_retry_connection_timer = NULL;
+static int g_retry_connection_count = 0;
+static Eina_Bool retry_connection(void* data)
{
- MA_SLOGE("[DEBUG] Start prepare func");
- int ret = -1;
- int retry_count = 0;
-
- /* Send hello */
- while (0 != ret) {
- if (retry_count == 100) {
- MA_SLOGE("[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE
- return;
- }
-
- ret = ma_dbus_request_hello();
- if (ret == 0) {
- MA_SLOGD("Success to request hello. retry count(%d)", retry_count);
- break;
- } else {
- usleep(300000);
- retry_count++;
+ int ret = ma_dbus_request_hello();
+ if (ret == 0) {
+ MA_SLOGD("Success to request hello. retry count(%d)", g_retry_connection_count);
+ g_retry_connection_count = 0;
+ if (g_retry_connection_timer) ecore_timer_del(g_retry_connection_timer);
+ g_retry_connection_timer = NULL;
+
+ ret = -1;
+ int retry_count = 0;
+
+ while (0 != ret) {
+ if (retry_count == 10) {
+ MA_SLOGE("[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE
+ break;
+ }
+ ret = __ma_connect_daemon(NULL);
+ if (ret == 0) {
+ MA_SLOGD("Success to connect daemon. retry count(%d)", retry_count);
+ break;
+ } else {
+ usleep(10000);
+ retry_count++;
+ }
}
+ return ECORE_CALLBACK_CANCEL;
}
+ g_retry_connection_count++;
+ return ECORE_CALLBACK_RENEW;
+}
- ret = -1;
- retry_count = 0;
-
- while (0 != ret) {
- if (retry_count == 10) {
- MA_SLOGE("[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE
- return;
- }
- ret = __ma_connect_daemon(NULL);
- if (ret == 0) {
- MA_SLOGD("Success to connect daemon. retry count(%d)", retry_count);
- break;
- } else {
- usleep(10000);
- retry_count++;
- }
+static void __start_prepare_func()
+{
+ if (ECORE_CALLBACK_RENEW == retry_connection(NULL)) {
+ ecore_timer_add(1.5f, retry_connection, NULL);
}
-
- return;
}
static void __end_prepare_func()
MA_SLOGI("[Client DEBUG] Unprepare");
+ if (g_retry_connection_timer) ecore_timer_del(g_retry_connection_timer);
+ g_retry_connection_timer = NULL;
+
ma_state_e state;
if (0 != ma_client_get_client_state(g_ma, &state)) {
DBusMessage* result_msg = NULL;
int result = 0;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, -1, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 1000, &err);
if (dbus_error_is_set(&err)) {
MA_SLOGE("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE