summaryrefslogtreecommitdiff
path: root/libs/binder/RpcSession.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-05-25 17:55:42 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-05-25 17:55:42 +0000
commitfaedb79fe76ee2f3304bf986de1d251e0c5d98ea (patch)
treecab7612fa6dd1e4b955e5021805809e364e0cf47 /libs/binder/RpcSession.cpp
parent60888bf80b0996859602bed43ad27da81aadb754 (diff)
parent1c3b2b131b4d4c687249efe63c0a420a7aa8db1f (diff)
Merge changes Id4971e54,Id80da21c,Ice446ec4,If10f00de,I4f59ad60 am: 8f0b7f288c am: 1c3b2b131b
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1716634 Change-Id: Ia44ce224ee650114c8e7c4cb96d7bf22b9f54a33
Diffstat (limited to 'libs/binder/RpcSession.cpp')
-rw-r--r--libs/binder/RpcSession.cpp17
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,