efreet - make efreet launch timeout configurable by env var
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 25 Aug 2019 10:24:54 +0000 (11:24 +0100)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 28 Aug 2019 04:30:52 +0000 (13:30 +0900)
also report as an ERR explicitly if its a timeout.

src/lib/efreet/efreet_cache.c

index 357ffab..0f9d349 100644 (file)
@@ -115,19 +115,36 @@ static void
 _ipc_launch(void)
 {
    char buf[PATH_MAX];
-   int num = 0;
+   int num;
+   int try_gap = 10000; // 10ms
+   int tries = 200; // 200 * 10ms == 2sec
+   const char *s;
 
+   s = getenv("EFREETD_CONNECT_TRIES");
+   if (s)
+     {
+        num = atoi(s);
+        if (num >= 0) tries = num;
+     }
+   s = getenv("EFREETD_CONNECT_TRY_GAP");
+   if (s)
+     {
+        num = atoi(s);
+        if (num >= 0) try_gap = num;
+     }
    if (run_in_tree)
      bs_binary_get(buf, sizeof(buf), "efreet", "efreetd");
    else
      snprintf(buf, sizeof(buf), PACKAGE_BIN_DIR "/efreetd");
    ecore_exe_run(buf, NULL);
-   while ((!ipc) && (num < 200))
+   num = 0;
+   while ((!ipc) && (num < tries))
      {
         num++;
-        usleep(10000);
+        usleep(try_gap);
         ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
      }
+   if (!ipc) ERR("Timeout in trying to start and then connect to efrteed");
 }
 
 static Eina_Bool