Modify aul_rpc_port_usr_exist() function 50/292250/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 2 May 2023 08:07:47 +0000 (08:07 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 2 May 2023 08:12:45 +0000 (08:12 +0000)
To avoid delay issue, the function uses access() function instead of
IPC with AMD.

Change-Id: Ifa096ad1ff66e09d21e4373dd214707681c38a45
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul_rpc_port.cc

index d1e7fa9..492d9e2 100644 (file)
@@ -350,17 +350,13 @@ extern "C" API int aul_rpc_port_usr_exist(const char* app_id,
     return AUL_R_EINVAL;
   }
 
-  tizen_base::Bundle b {{AUL_K_RPC_PORT, port_name}};
-  int ret = AppRequest(RPC_PORT_EXIST, uid)
-      .With(b)
-      .SetAppId(app_id)
-      .SendSimply();
-  if (ret < 0) {
-    _E("Failed to send request. error(%d)", ret);
-    return ret;
-  }
+  char* port_path;
+  if (aul_rpc_port_usr_get_path(app_id, port_name, uid, &port_path) != AUL_R_OK)
+    return AUL_R_ENOMEM;
 
-  *exist = (ret == 1) ? true : false;
+  int ret = access(port_path, F_OK);
+  free(port_path);
+  *exist = (ret == 0) ? true : false;
   return AUL_R_OK;
 }