From 4799baf37668ee1a3af18e3b126672d47fd7f78a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 20 May 2020 12:40:15 +0900 Subject: [PATCH] Fix AUL request handler If the aul handler is not initialized, the result has to be delivered. Change-Id: I7808c7713d1a4df0d3c51f6754b1cd6fc3b20425 Signed-off-by: Hwankyu Jhun --- src/aul_launch.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/aul_launch.c b/src/aul_launch.c index 3c9a7f4..7b5376a 100644 --- a/src/aul_launch.c +++ b/src/aul_launch.c @@ -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) && -- 2.7.4