Send a result with a sequence number 30/303230/2
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 22 Dec 2023 02:09:20 +0000 (11:09 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 22 Dec 2023 03:15:44 +0000 (12:15 +0900)
When sending the result to amd, the application sends the sequence number.
amd will handle the reply by the sequence number.

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

index e09b9d2..f28ea2e 100644 (file)
@@ -55,6 +55,7 @@ struct aul_request_s {
        int cmd;
        int clifd;
        bundle *b;
+       int seq_num;
 };
 
 typedef struct aul_request_s *aul_request_h;
@@ -377,6 +378,7 @@ static void __destroy_request(struct aul_request_s *req)
 static struct aul_request_s *__create_request(int cmd, int clifd, bundle *b)
 {
        struct aul_request_s *req;
+       const char *val;
 
        req = malloc(sizeof(struct aul_request_s));
        if (!req) {
@@ -387,6 +389,8 @@ static struct aul_request_s *__create_request(int cmd, int clifd, bundle *b)
        req->cmd = cmd;
        req->clifd = clifd;
        req->b = b;
+       val = bundle_get_val(b, AUL_K_SEQ_NUM);
+       req->seq_num = val ? atoi(val) : -1;
 
        return req;
 }
@@ -400,12 +404,13 @@ static int __send_result(struct aul_request_s *req, int res)
                if (__find_client_channel(req->clifd) == NULL)
                        _E("Failed to find client channel. fd(%d)", req->clifd);
 
+               aul_sock_send_result_v2(req->clifd, req->seq_num, false);
                ret = aul_sock_send_result_v2(req->clifd, res, false);
                g_rec_mutex_unlock(&__context.mutex);
                if (ret < 0) {
-                       _E("Failed to send result. cmd(%s:%d)",
+                       _E("Failed to send result. cmd(%s:%d), seq(%d)",
                                        aul_cmd_convert_to_string(req->cmd),
-                                       req->cmd);
+                                       req->cmd, req->seq_num);
                        return ret;
                }
        }
@@ -434,11 +439,13 @@ static gboolean __dispatch_request(gpointer data)
 
        if (req->cmd >= APP_START && req->cmd < ARRAY_SIZE(__dispatcher) &&
                        __dispatcher[req->cmd]) {
-               _W("Command(%s:%d)",
+               _W("[%d] Command(%s:%d)",
+                               req->seq_num,
                                aul_cmd_convert_to_string(req->cmd), req->cmd);
                __dispatcher[req->cmd](req);
        } else {
-               _E("Command(%s:%d) is not available",
+               _E("[%d] Command(%s:%d) is not available",
+                               req->seq_num,
                                aul_cmd_convert_to_string(req->cmd), req->cmd);
        }