Fix AUL request handler 75/233875/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 20 May 2020 03:40:15 +0000 (12:40 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 20 May 2020 03:43:23 +0000 (12:43 +0900)
If the aul handler is not initialized, the result has to be delivered.

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

index 3c9a7f4..7b5376a 100644 (file)
@@ -306,6 +306,24 @@ static struct aul_request_s *__create_request(int cmd, int clifd, bundle *b)
        return req;
 }
 
+static int __send_result(struct aul_request_s *req, int res)
+{
+       int ret;
+
+       if (req->cmd != WIDGET_GET_CONTENT && req->clifd > 0) {
+               ret = aul_sock_send_result(req->clifd, res);
+               req->clifd = -1;
+               if (ret < 0) {
+                       _E("Failed to send result. cmd(%s:%d)",
+                                       aul_cmd_convert_to_string(req->cmd),
+                                       req->cmd);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
 static gboolean __dispatch_request(gpointer data)
 {
        struct aul_request_s *req = (struct aul_request_s *)data;
@@ -313,23 +331,17 @@ static gboolean __dispatch_request(gpointer data)
 
        if (!__context.initialized) {
                _W("Ignore request(%d)", req->cmd);
+               __send_result(req, -1);
                __destroy_request(req);
                return G_SOURCE_REMOVE;
        }
 
        aul_worker_remove_anr_timer(__context.worker);
 
-       if (req->cmd != WIDGET_GET_CONTENT && req->clifd > 0) {
-               ret = aul_sock_send_result(req->clifd, 0);
-               if (ret < 0) {
-                       _E("Failed to send result. cmd(%s:%d)",
-                                       aul_cmd_convert_to_string(req->cmd),
-                                       req->cmd);
-                       __destroy_request(req);
-                       return G_SOURCE_REMOVE;
-               }
-
-               req->clifd = -1;
+       ret = __send_result(req, 0);
+       if (ret < 0) {
+               __destroy_request(req);
+               return G_SOURCE_REMOVE;
        }
 
        if (req->cmd >= APP_START && req->cmd < ARRAY_SIZE(__dispatcher) &&