diff options
Diffstat (limited to 'libs/binder/RpcSession.cpp')
| -rw-r--r-- | libs/binder/RpcSession.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 7c458c123a..d05b84834f 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -86,8 +86,7 @@ bool RpcSession::addNullDebuggingClient() { return false; } - addClientConnection(std::move(serverFd)); - return true; + return addClientConnection(std::move(serverFd)); } sp<IBinder> RpcSession::getRootObject() { @@ -100,12 +99,12 @@ status_t RpcSession::getRemoteMaxThreads(size_t* maxThreads) { return state()->getMaxThreads(connection.fd(), sp<RpcSession>::fromExisting(this), maxThreads); } -status_t RpcSession::transact(const RpcAddress& address, uint32_t code, const Parcel& data, +status_t RpcSession::transact(const sp<IBinder>& binder, uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { ExclusiveConnection connection(sp<RpcSession>::fromExisting(this), (flags & IBinder::FLAG_ONEWAY) ? ConnectionUse::CLIENT_ASYNC : ConnectionUse::CLIENT); - return state()->transact(connection.fd(), address, code, data, + return state()->transact(connection.fd(), binder, code, data, sp<RpcSession>::fromExisting(this), reply, flags); } @@ -199,7 +198,8 @@ void RpcSession::join(unique_fd client) { state()->getAndExecuteCommand(connection->fd, sp<RpcSession>::fromExisting(this)); if (error != OK) { - ALOGI("Binder connection thread closing w/ status %s", statusToString(error).c_str()); + LOG_RPC_DETAIL("Binder connection thread closing w/ status %s", + statusToString(error).c_str()); break; } } @@ -311,24 +311,25 @@ bool RpcSession::setupOneSocketClient(const RpcSocketAddress& addr, int32_t id) LOG_RPC_DETAIL("Socket at %s client with fd %d", addr.toString().c_str(), serverFd.get()); - addClientConnection(std::move(serverFd)); - return true; + return addClientConnection(std::move(serverFd)); } ALOGE("Ran out of retries to connect to %s", addr.toString().c_str()); return false; } -void RpcSession::addClientConnection(unique_fd fd) { +bool RpcSession::addClientConnection(unique_fd fd) { std::lock_guard<std::mutex> _l(mMutex); if (mShutdownTrigger == nullptr) { mShutdownTrigger = FdTrigger::make(); + if (mShutdownTrigger == nullptr) return false; } sp<RpcConnection> session = sp<RpcConnection>::make(); session->fd = std::move(fd); mClientConnections.push_back(session); + return true; } void RpcSession::setForServer(const wp<RpcServer>& server, int32_t sessionId, |