Add reply timeout 11/227211/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 10 Mar 2020 10:18:20 +0000 (19:18 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 10 Mar 2020 10:18:20 +0000 (19:18 +0900)
While calling g_dbus_connection_send_message_with_reply_sync(),
the process is blocked until a reply is received or the timeout is reached.
This patch adds the timeout to calling g_dbus_connection_send_message_with_reply_sync().
The interval is 5000 milliseconds.

Change-Id: Ib3b00cd1899b40ed295d2ac73ed4069958064648
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul_window.c

index 14af314..66ee23e 100644 (file)
@@ -36,7 +36,7 @@ static GDBusConnection *system_conn;
 #define WM_INTERFACE_NAME      "org.enlightenment.wm.proc"
 #define WM_METHOD_NAME_INFO    "GetVisibleWinInfo"
 #define WM_METHOD_NAME_FOCUS   "GetFocusProc"
-
+#define WM_DBUS_TIMEOUT 5000
 
 typedef struct _window_info {
        unsigned int gid;
@@ -86,7 +86,8 @@ API int aul_window_stack_get(aul_window_stack_h *handle)
        }
 
        reply = g_dbus_connection_send_message_with_reply_sync(system_conn, msg,
-                       G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, NULL, NULL, &err);
+                       G_DBUS_SEND_MESSAGE_FLAGS_NONE, WM_DBUS_TIMEOUT,
+                       NULL, NULL, &err);
 
        if (!reply) {
                if (err != NULL) {
@@ -312,7 +313,8 @@ API int aul_window_get_focused_pid(pid_t *pid)
        }
 
        reply = g_dbus_connection_send_message_with_reply_sync(system_conn, msg,
-                       G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, NULL, NULL, &err);
+                       G_DBUS_SEND_MESSAGE_FLAGS_NONE, WM_DBUS_TIMEOUT,
+                       NULL, NULL, &err);
 
        if (!reply) {
                _E("reply is null");