*/
int aul_sock_create_launchpad_client_without_timeout(const char *pad_type, uid_t uid);
+/**
+ * This API is only for Appfw internally.
+ */
+int aul_sock_send_raw_data(int fd, unsigned char *raw_data, size_t length, bool do_close);
+
#ifdef __cplusplus
}
#endif
static int __send_result(struct aul_request_s *req, int res)
{
int ret;
+ int buf[2];
if (req->cmd != WIDGET_GET_CONTENT && req->clifd >= 0) {
g_rec_mutex_lock(&__context.mutex);
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->req_id, false);
- ret = aul_sock_send_result_v2(req->clifd, res, false);
+ buf[0] = req->req_id;
+ buf[1] = res;
+ ret = aul_sock_send_raw_data(req->clifd, (unsigned char *)&buf,
+ sizeof(int) + sizeof(int), false);
g_rec_mutex_unlock(&__context.mutex);
if (ret < 0) {
_E("Failed to send result. cmd(%s:%d), seq(%d)",
return ret;
}
+
+extern "C" API int aul_sock_send_raw_data(int fd, unsigned char* raw_data,
+ size_t length, bool do_close) {
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX)) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ int ret = send(fd, raw_data, length, MSG_NOSIGNAL);
+ if (ret < 0)
+ _E("send() is failed. fd(%d), errno(%d)", fd, errno);
+
+ if (do_close)
+ close(fd);
+
+ return ret;
+}