Consider app com broker 20/303320/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 25 Dec 2023 22:51:07 +0000 (07:51 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 26 Dec 2023 00:21:25 +0000 (09:21 +0900)
AMD receives the raw data that is 8 bytes from applications.
The app com broker should consider receiving the modified raw data.

Change-Id: I79f60b41ccebfa809a41b8ce2776943811055302
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/api/amd_api_app_request_broker.cc
src/lib/app_com/app_com_socket.cc

index c32ff5d..d711d25 100644 (file)
@@ -283,16 +283,15 @@ class AppRequestBroker {
 gboolean ClientChannel::OnDataReceived(GIOChannel* channel, GIOCondition cond,
     gpointer user_data) {
   auto* handle = static_cast<ClientChannel*>(user_data);
-  int req_id = -1;
-  int ret = handle->Receive(&req_id, sizeof(int));
-  if (ret != 0)
-    _E("Failed to receive seq num");
-
-  int res;
-  ret = handle->Receive(&res, sizeof(int));
-  if (ret != 0)
-    res = -ECOMM;
+  int buf[2];
+  int ret = handle->Receive(&buf, sizeof(int) + sizeof(int));
+  if (ret != 0) {
+    _E("Failed to receive data");
+    buf[1] = -ECOMM;
+  }
 
+  int req_id = buf[0];
+  int res = buf[1];
   _W("id(%d), pid(%d), result(%d)", req_id, handle->GetPid(), ret);
   auto result_cb = handle->FindResultCb(req_id);
   if (result_cb != nullptr)
index 11ff8af..7cc17c3 100644 (file)
@@ -99,13 +99,14 @@ int AppComSocket::SendMessage(
 
 int AppComSocket::ReceiveResult() {
   std::lock_guard<std::recursive_mutex> lock(GetMutex());
-  int res;
-  int ret = ClientSocket::Receive(&res, sizeof(int));
+  int buf[2];
+  int ret = ClientSocket::Receive(&buf, sizeof(int) + sizeof(int));
   if (ret != 0) {
     _E("Failed to receive result data. error(%d)", ret);
     return ret;
   }
 
+  int res = buf[1];
   return res;
 }