Fix cynara core implemention 25/266925/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 22 Nov 2021 12:29:08 +0000 (21:29 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 23 Nov 2021 01:53:21 +0000 (01:53 +0000)
- Uses g_unix_fd_add_full() instead of g_unix_fd_add()
- Adds logs for debugging cynara check

Change-Id: I69d6e0cb4b7272a6724c152656e6fa78459fc571
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/modules/cynara-core/src/amd_cynara_core.c

index 1d0ff21..b2bc4b3 100644 (file)
@@ -156,7 +156,7 @@ static void __resp_cb(cynara_check_id id, cynara_async_call_cause cause,
        struct caller_info *info = (struct caller_info *)data;
        char *privilege;
 
-       _D("check id %u, cause %d, resp %d", id, cause, resp);
+       _W("check id %u, cause %d, resp %d", id, cause, resp);
 
        privilege = g_hash_table_lookup(info->id_table,
                        GUINT_TO_POINTER(id));
@@ -212,6 +212,7 @@ static enum amd_cynara_result __check_server(struct caller_info *info,
                return AMD_CYNARA_RET_ERROR;
        }
 
+       _W("check id %u, privilege %s, client %s", id, privilege, info->client);
        g_hash_table_insert(info->id_table, GUINT_TO_POINTER(id),
                        strdup(privilege));
 
@@ -515,6 +516,7 @@ static gboolean __proc_cb(gint fd, GIOCondition cond, gpointer data)
 {
        int ret;
 
+       _W("[__CYNARA__] fd(%d), condition(%d)", fd, cond);
        if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
                cynara_fd_id = 0;
                return G_SOURCE_REMOVE;
@@ -546,7 +548,8 @@ static void __status_cb(int old_fd, int new_fd, cynara_async_status status,
                if (status == CYNARA_STATUS_FOR_RW)
                        cond |= G_IO_OUT;
 
-               cynara_fd_id = g_unix_fd_add(new_fd, cond, __proc_cb, data);
+               cynara_fd_id = g_unix_fd_add_full(G_PRIORITY_HIGH, new_fd, cond,
+                               __proc_cb, data, NULL);
                cynara_fd = new_fd;
        }
 }