Loading libs/binder/RpcServer.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ void RpcServer::join() { bool RpcServer::acceptOne() { LOG_ALWAYS_FATAL_IF(!mAgreedExperimental, "no!"); LOG_ALWAYS_FATAL_IF(mServer.get() == -1, "RpcServer must be setup to join."); LOG_ALWAYS_FATAL_IF(!hasServer(), "RpcServer must be setup to join."); unique_fd clientFd( TEMP_FAILURE_RETRY(accept4(mServer.get(), nullptr, nullptr /*length*/, SOCK_CLOEXEC))); Loading Loading @@ -232,11 +232,7 @@ void RpcServer::establishConnection(sp<RpcServer>&& server, base::unique_fd clie bool RpcServer::setupSocketServer(const RpcSocketAddress& addr) { LOG_RPC_DETAIL("Setting up socket server %s", addr.toString().c_str()); { std::lock_guard<std::mutex> _l(mLock); LOG_ALWAYS_FATAL_IF(mServer.get() != -1, "Each RpcServer can only have one server."); } LOG_ALWAYS_FATAL_IF(hasServer(), "Each RpcServer can only have one server."); unique_fd serverFd( TEMP_FAILURE_RETRY(socket(addr.addr()->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0))); Loading Loading @@ -275,4 +271,9 @@ void RpcServer::onSessionTerminating(const sp<RpcSession>& session) { (void)mSessions.erase(it); } bool RpcServer::hasServer() { std::lock_guard<std::mutex> _l(mLock); return mServer.ok(); } } // namespace android libs/binder/include/binder/RpcServer.h +5 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,11 @@ public: */ [[nodiscard]] bool setupInetServer(unsigned int port, unsigned int* assignedPort); /** * If setup*Server has been successful, return true. Otherwise return false. */ [[nodiscard]] bool hasServer(); void iUnderstandThisCodeIsExperimentalAndIWillNotUseItInProduction(); /** Loading Loading
libs/binder/RpcServer.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ void RpcServer::join() { bool RpcServer::acceptOne() { LOG_ALWAYS_FATAL_IF(!mAgreedExperimental, "no!"); LOG_ALWAYS_FATAL_IF(mServer.get() == -1, "RpcServer must be setup to join."); LOG_ALWAYS_FATAL_IF(!hasServer(), "RpcServer must be setup to join."); unique_fd clientFd( TEMP_FAILURE_RETRY(accept4(mServer.get(), nullptr, nullptr /*length*/, SOCK_CLOEXEC))); Loading Loading @@ -232,11 +232,7 @@ void RpcServer::establishConnection(sp<RpcServer>&& server, base::unique_fd clie bool RpcServer::setupSocketServer(const RpcSocketAddress& addr) { LOG_RPC_DETAIL("Setting up socket server %s", addr.toString().c_str()); { std::lock_guard<std::mutex> _l(mLock); LOG_ALWAYS_FATAL_IF(mServer.get() != -1, "Each RpcServer can only have one server."); } LOG_ALWAYS_FATAL_IF(hasServer(), "Each RpcServer can only have one server."); unique_fd serverFd( TEMP_FAILURE_RETRY(socket(addr.addr()->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0))); Loading Loading @@ -275,4 +271,9 @@ void RpcServer::onSessionTerminating(const sp<RpcSession>& session) { (void)mSessions.erase(it); } bool RpcServer::hasServer() { std::lock_guard<std::mutex> _l(mLock); return mServer.ok(); } } // namespace android
libs/binder/include/binder/RpcServer.h +5 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,11 @@ public: */ [[nodiscard]] bool setupInetServer(unsigned int port, unsigned int* assignedPort); /** * If setup*Server has been successful, return true. Otherwise return false. */ [[nodiscard]] bool hasServer(); void iUnderstandThisCodeIsExperimentalAndIWillNotUseItInProduction(); /** Loading