Loading cmds/service/service.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ int main(int argc, char* const argv[]) ProcessState::initWithDriver("/dev/vndbinder"); #endif #ifndef __ANDROID__ setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingThreads = 1})); setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingConnections = 1})); #endif sp<IServiceManager> sm = defaultServiceManager(); fflush(stdout); Loading libs/binder/RpcSession.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ size_t RpcSession::getMaxIncomingThreads() { return mMaxIncomingThreads; } void RpcSession::setMaxOutgoingThreads(size_t threads) { void RpcSession::setMaxOutgoingConnections(size_t threads) { RpcMutexLockGuard _l(mMutex); LOG_ALWAYS_FATAL_IF(mStartedSetup, "Must set max outgoing threads before setting up connections"); Loading Loading @@ -932,7 +932,8 @@ status_t RpcSession::ExclusiveConnection::find(const sp<RpcSession>& session, Co (session->server() ? "This is a server session, so see RpcSession::setMaxIncomingThreads " "for the corresponding client" : "This is a client session, so see RpcSession::setMaxOutgoingThreads " : "This is a client session, so see " "RpcSession::setMaxOutgoingConnections " "for this client or RpcServer::setMaxThreads for the corresponding " "server")); return WOULD_BLOCK; Loading libs/binder/ServiceManagerHost.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -159,8 +159,8 @@ sp<IBinder> getDeviceService(std::vector<std::string>&& serviceDispatcherArgs, LOG_ALWAYS_FATAL_IF(!forwardResult->hostPort().has_value()); auto rpcSession = RpcSession::make(); if (options.maxOutgoingThreads.has_value()) { rpcSession->setMaxOutgoingThreads(*options.maxOutgoingThreads); if (options.maxOutgoingConnections.has_value()) { rpcSession->setMaxOutgoingConnections(*options.maxOutgoingConnections); } if (status_t status = rpcSession->setupInetClient("127.0.0.1", *forwardResult->hostPort()); Loading libs/binder/include/binder/IServiceManager.h +5 −5 Original line number Diff line number Diff line Loading @@ -224,12 +224,12 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid, // } // Resources are cleaned up when the object is destroyed. // // For each returned binder object, at most |maxOutgoingThreads| outgoing threads are instantiated. // Hence, only |maxOutgoingThreads| calls can be made simultaneously. Additional calls are blocked // if there are |maxOutgoingThreads| ongoing calls. See RpcSession::setMaxOutgoingThreads. // If |maxOutgoingThreads| is not set, default is |RpcSession::kDefaultMaxOutgoingThreads|. // For each returned binder object, at most |maxOutgoingConnections| outgoing connections are // instantiated, depending on how many the service on the device is configured with. // Hence, only |maxOutgoingConnections| calls can be made simultaneously. // See also RpcSession::setMaxOutgoingConnections. struct RpcDelegateServiceManagerOptions { std::optional<size_t> maxOutgoingThreads; std::optional<size_t> maxOutgoingConnections; }; sp<IServiceManager> createRpcDelegateServiceManager( const RpcDelegateServiceManagerOptions& options); Loading libs/binder/include/binder/RpcServer.h +4 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,10 @@ public: [[nodiscard]] status_t setupExternalServer(base::unique_fd serverFd); /** * This must be called before adding a client session. * This must be called before adding a client session. This corresponds * to the number of incoming connections to RpcSession objects in the * server, which will correspond to the number of outgoing connections * in client RpcSession objects. * * If this is not specified, this will be a single-threaded server. * Loading Loading
cmds/service/service.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ int main(int argc, char* const argv[]) ProcessState::initWithDriver("/dev/vndbinder"); #endif #ifndef __ANDROID__ setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingThreads = 1})); setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingConnections = 1})); #endif sp<IServiceManager> sm = defaultServiceManager(); fflush(stdout); Loading
libs/binder/RpcSession.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ size_t RpcSession::getMaxIncomingThreads() { return mMaxIncomingThreads; } void RpcSession::setMaxOutgoingThreads(size_t threads) { void RpcSession::setMaxOutgoingConnections(size_t threads) { RpcMutexLockGuard _l(mMutex); LOG_ALWAYS_FATAL_IF(mStartedSetup, "Must set max outgoing threads before setting up connections"); Loading Loading @@ -932,7 +932,8 @@ status_t RpcSession::ExclusiveConnection::find(const sp<RpcSession>& session, Co (session->server() ? "This is a server session, so see RpcSession::setMaxIncomingThreads " "for the corresponding client" : "This is a client session, so see RpcSession::setMaxOutgoingThreads " : "This is a client session, so see " "RpcSession::setMaxOutgoingConnections " "for this client or RpcServer::setMaxThreads for the corresponding " "server")); return WOULD_BLOCK; Loading
libs/binder/ServiceManagerHost.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -159,8 +159,8 @@ sp<IBinder> getDeviceService(std::vector<std::string>&& serviceDispatcherArgs, LOG_ALWAYS_FATAL_IF(!forwardResult->hostPort().has_value()); auto rpcSession = RpcSession::make(); if (options.maxOutgoingThreads.has_value()) { rpcSession->setMaxOutgoingThreads(*options.maxOutgoingThreads); if (options.maxOutgoingConnections.has_value()) { rpcSession->setMaxOutgoingConnections(*options.maxOutgoingConnections); } if (status_t status = rpcSession->setupInetClient("127.0.0.1", *forwardResult->hostPort()); Loading
libs/binder/include/binder/IServiceManager.h +5 −5 Original line number Diff line number Diff line Loading @@ -224,12 +224,12 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid, // } // Resources are cleaned up when the object is destroyed. // // For each returned binder object, at most |maxOutgoingThreads| outgoing threads are instantiated. // Hence, only |maxOutgoingThreads| calls can be made simultaneously. Additional calls are blocked // if there are |maxOutgoingThreads| ongoing calls. See RpcSession::setMaxOutgoingThreads. // If |maxOutgoingThreads| is not set, default is |RpcSession::kDefaultMaxOutgoingThreads|. // For each returned binder object, at most |maxOutgoingConnections| outgoing connections are // instantiated, depending on how many the service on the device is configured with. // Hence, only |maxOutgoingConnections| calls can be made simultaneously. // See also RpcSession::setMaxOutgoingConnections. struct RpcDelegateServiceManagerOptions { std::optional<size_t> maxOutgoingThreads; std::optional<size_t> maxOutgoingConnections; }; sp<IServiceManager> createRpcDelegateServiceManager( const RpcDelegateServiceManagerOptions& options); Loading
libs/binder/include/binder/RpcServer.h +4 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,10 @@ public: [[nodiscard]] status_t setupExternalServer(base::unique_fd serverFd); /** * This must be called before adding a client session. * This must be called before adding a client session. This corresponds * to the number of incoming connections to RpcSession objects in the * server, which will correspond to the number of outgoing connections * in client RpcSession objects. * * If this is not specified, this will be a single-threaded server. * Loading