e_dbus_conn: added E_DBUS_CONN_INIT_RETRY_INTERVALS to support 42/192742/4 accepted/tizen/5.0/unified/20181115.063706 accepted/tizen/unified/20181114.074436 submit/tizen/20181114.011255 submit/tizen_5.0/20181114.012131
authorGwanglim Lee <gl77.lee@samsung.com>
Fri, 9 Nov 2018 02:28:32 +0000 (11:28 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 14 Nov 2018 00:43:32 +0000 (00:43 +0000)
time intervals during retrying D-BUS connection.

If user wants to connect with D-BUS through another thread,
then we also need to check that wants to use time intervals
during retrying connection.

It is required for some systems which don't support sync call
for connecting D-BUS to avoid thread problems.

Change-Id: Id151b3fc722e34d6a52aa28d5cdfc392d76a5edb

src/bin/e_dbus_conn.c
src/bin/e_dbus_conn.h

index 7f6222d..9846160 100644 (file)
@@ -93,6 +93,9 @@ _e_dbus_conn_init_thread_heavy(void *data, Ecore_Thread *th, void *msg_data)
              *res = EINA_TRUE;
              break;
           }
+
+        if (ed_thread.retry_intervals)
+          usleep(ed_thread.retry_intervals);
      }
 
    ecore_thread_feedback(th, res);
@@ -205,6 +208,8 @@ e_dbus_conn_init(void)
 {
    char *env = NULL;
    E_DBus_Conn *ed = NULL;
+   unsigned int num;
+   Eina_Bool res;
 
    if (++_e_dbus_conn_init_count != 1) return _e_dbus_conn_init_count;
    if (!eldbus_init()) return --_e_dbus_conn_init_count;
@@ -234,6 +239,7 @@ e_dbus_conn_init(void)
    ed->conn_type = ELDBUS_CONNECTION_TYPE_UNKNOWN;
    ed->retry_cnt = E_DBUS_CONN_DEFAULT_RETRY_COUNT;
    ed->init_status = E_DBUS_CONN_INIT_YET_STARTED;
+   ed->retry_intervals = 0;
 
    E_EVENT_DBUS_CONN_INIT_DONE = ecore_event_type_new();
 
@@ -243,6 +249,21 @@ e_dbus_conn_init(void)
      {
         ed->use_thread = EINA_TRUE;
         E_FREE(env);
+
+        /* If user wants to connect with D-BUS through another thread,
+         * then we also need to check that wants to use time intervals
+         * during retrying connection.
+         *
+         * It is required for some systems which don't support sync call
+         * for connecting D-BUS to avoid thread problems.
+         */
+        env = e_util_env_get("E_DBUS_CONN_INIT_RETRY_INTERVALS");
+        if (env)
+          {
+             res = e_util_string_to_uint(env, &num, 10);
+             if (res) ed->retry_intervals = num;
+             E_FREE(env);
+          }
      }
 
    env = e_util_env_get("E_DBUS_CONN_INIT_RETRY_COUNT");
index 3b4152d..83b1ba5 100644 (file)
@@ -31,6 +31,7 @@ struct _E_DBus_Conn
    Eina_Bool use_thread : 1;
    Eldbus_Connection *conn;
    Eldbus_Connection_Type conn_type;
+   unsigned int retry_intervals; /* suspend re-connection for microsecond intervals */
 };
 
 typedef struct _E_DBus_Conn_Init_Done_Event E_DBus_Conn_Init_Done_Event;