Check socket existence 67/266167/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 8 Nov 2021 22:46:15 +0000 (07:46 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 8 Nov 2021 22:46:15 +0000 (07:46 +0900)
If the client channel doesn't exist, AMD checks whether the socket
exists or not before connecting to the app socket.

Change-Id: Ife67257302f85bcad3324b889f010328aebfcf75
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_app_request_broker.cc

index 8732a7d..e05e1af 100644 (file)
@@ -30,6 +30,7 @@
 #include <bundle_cpp.h>
 #include <parcel.hh>
 
+#include "lib/amd_app_status.h"
 #include "lib/amd_util.h"
 #include "lib/socket/client_socket.hh"
 
@@ -270,6 +271,13 @@ int _app_request_broker_send(app_request_t* request,
   auto& broker = AppRequestBroker::GetInst();
   auto channel = broker.FindClientChannel(request->pid);
   if (channel == nullptr) {
+    app_status_h app_status = _app_status_find(request->pid);
+    if (app_status == nullptr)
+      return -EINVAL;
+
+    if (!_app_status_socket_exists(app_status))
+      return -ECOMM;
+
     channel = broker.CreateClientChannel(request->pid, request->uid);
     if (channel == nullptr)
       return -ECOMM;