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;
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) &&