Add request pending condition 53/286053/3
authorChanggyu Choi <changyu.choi@samsung.com>
Tue, 27 Dec 2022 03:06:09 +0000 (12:06 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Tue, 27 Dec 2022 03:23:20 +0000 (12:23 +0900)
This patch adds a condition for pending (such as RPC_PORT_STUB_PREPARE) in case of a request that requires some pending.

Change-Id: I771c9f0d77763cd05f1527485c6612400e09b0f1
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/lib/amd_request.c

index 53bb9fed1d4fba83916936b948ee1300e181ffa8..bb8af4a8f671ae1b08c79face65114b8f9e957a0 100644 (file)
@@ -489,6 +489,16 @@ static bool __can_be_implicit_launch(int cmd)
        }
 }
 
+static bool __check_to_need_pending(request_h req)
+{
+       switch (req->cmd) {
+       case RPC_PORT_PREPARE_STUB:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static int __check_request(request_h req)
 {
        int pid;
@@ -528,8 +538,18 @@ static int __check_request(request_h req)
 
        pid = _app_status_get_pid(app_status);
        item = g_hash_table_lookup(pending_table, GINT_TO_POINTER(pid));
-       if (item == NULL)
-               return 0;
+       if (item == NULL) {
+               if (!__check_to_need_pending(req))
+                       return 0;
+
+               item = calloc(1, sizeof(struct pending_item));
+               if (item == NULL) {
+                       _E("Out of memory");
+                       return -1;
+               }
+               item->pid = pid;
+               g_hash_table_insert(pending_table, GINT_TO_POINTER(pid), item);
+       }
 
        if (!_app_status_is_starting(app_status)) {
                req->t_pid = pid;