Send result while handling the launch request 56/292856/6
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 16 May 2023 04:01:54 +0000 (04:01 +0000)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 16 May 2023 05:55:12 +0000 (05:55 +0000)
Even if the loader process is not prepared, the launchpad-process-pool
sends the result to the amd. If the initialization of the loader process
is delayed, the caller process cannot get the launched process ID.
To ensure consistency of operation of handling the launch request, the caller
has to get the result from the amd.

Change-Id: Idd523c2a1d3743a39d743833adc801ddb02e2f1a
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad-process-pool/launchpad.cc
src/launchpad-process-pool/request.cc

index 3176a540b44fefdf0c3e71a5ca6a939ac4f6f1f3..d4f0ba42482b03ad623a8d585644f16ccd436d50 100644 (file)
@@ -481,6 +481,7 @@ Launchpad::LaunchResult Launchpad::LaunchRequestDo(
     CheckAndPrepareLoaderContext(loader_context.get());
     CPUBoostController::DoBoost(loader_context->GetPid(),
         CPUBoostController::Level::Strong, 10000);
+    request->SendResult(loader_context->GetPid());
     pending_requests_.push_back(std::move(request));
     return LaunchResult::Pending;
   }
index 98a87b5754dcd6272191faa2cf31f1718a987f76..46d80f6e719897cf174b9c282fdaf00dae7d8c69 100644 (file)
@@ -77,7 +77,11 @@ pid_t Request::GetPid() const {
 }
 
 void Request::SendResult(int result) {
+  if (client_socket_->IsClosed())
+    return;
+
   client_socket_->Send(static_cast<void*>(&result), sizeof(result));
+  client_socket_->Close();
 }
 
 void Request::SetLoaderContext(std::shared_ptr<LoaderContext> context) {