pdx_benchmarks: Let the service create sockets by itself
Default implementation of Endpoint::Create() takes the socket name
as provided by the init process when it forks. pdx_benchmark is not
a service but a command-line utility and it is being started manually
and not through init process. So, named sockets are not available.
Instead, it must create a socket by the specified name. For this,
it must use Endpoint::CreateAndBindSocket() method.
Bug: 37507039
Test: Tested manually on device: `pdx_benchmarks --service foo`.
Change-Id: If30bfa7138f5a97ba0bff9e61460c6bd3697ec19
diff --git a/libs/vr/libpdx_default_transport/pdx_benchmarks.cpp b/libs/vr/libpdx_default_transport/pdx_benchmarks.cpp
index 0b658fb..fa0adf0 100644
--- a/libs/vr/libpdx_default_transport/pdx_benchmarks.cpp
+++ b/libs/vr/libpdx_default_transport/pdx_benchmarks.cpp
@@ -516,9 +516,8 @@
std::cerr << "Starting service instance " << service_id_counter
<< std::endl;
auto service = BenchmarkService::Create(
- android::pdx::default_transport::Endpoint::Create(
+ android::pdx::default_transport::Endpoint::CreateAndBindSocket(
GetServicePath(path, service_id_counter),
- android::pdx::default_transport::Endpoint::kDefaultMode,
android::pdx::default_transport::Endpoint::kBlocking));
if (!service) {
std::cerr << "Failed to create service instance!!" << std::endl;