summaryrefslogtreecommitdiff
path: root/libs/binder/RpcState.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-06-02 18:16:19 +0000
committer Steven Moreland <smoreland@google.com> 2021-06-02 18:17:51 +0000
commit103424e021792e9e92728ff1d9a657a2f9ecd174 (patch)
treed9c766df473f9a4867dff9b9135542cd61a65fd3 /libs/binder/RpcState.cpp
parente54384bbd4d4c3b433b180e8f25c15266ae21228 (diff)
libbinder: RPC more symmetrical max threads
Now, RpcServer and RpcSession both keep track of their max threads using the same variable, and the server can therefore request the number of reverse connections possible. Bug: 185167543 Test: N/A Change-Id: Ieaff69c8c2da2faf7598aed7e862601a1fcd7a00
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r--libs/binder/RpcState.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp
index e18179e4a8..76df97069c 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -625,34 +625,34 @@ status_t RpcState::processTransactInternal(const base::unique_fd& fd, const sp<R
} else {
LOG_RPC_DETAIL("Got special transaction %u", transaction->code);
- sp<RpcServer> server = session->server().promote();
- if (server) {
- // special case for 'zero' address (special server commands)
- switch (transaction->code) {
- case RPC_SPECIAL_TRANSACT_GET_ROOT: {
- replyStatus = reply.writeStrongBinder(server->getRootObject());
- break;
- }
- case RPC_SPECIAL_TRANSACT_GET_MAX_THREADS: {
- replyStatus = reply.writeInt32(server->getMaxThreads());
- break;
- }
- case RPC_SPECIAL_TRANSACT_GET_SESSION_ID: {
- // only sessions w/ services can be the source of a
- // session ID (so still guarded by non-null server)
- //
- // sessions associated with servers must have an ID
- // (hence abort)
- int32_t id = session->mId.value();
- replyStatus = reply.writeInt32(id);
- break;
- }
- default: {
- replyStatus = UNKNOWN_TRANSACTION;
+ switch (transaction->code) {
+ case RPC_SPECIAL_TRANSACT_GET_MAX_THREADS: {
+ replyStatus = reply.writeInt32(session->getMaxThreads());
+ break;
+ }
+ case RPC_SPECIAL_TRANSACT_GET_SESSION_ID: {
+ // for client connections, this should always report the value
+ // originally returned from the server
+ int32_t id = session->mId.value();
+ replyStatus = reply.writeInt32(id);
+ break;
+ }
+ default: {
+ sp<RpcServer> server = session->server().promote();
+ if (server) {
+ switch (transaction->code) {
+ case RPC_SPECIAL_TRANSACT_GET_ROOT: {
+ replyStatus = reply.writeStrongBinder(server->getRootObject());
+ break;
+ }
+ default: {
+ replyStatus = UNKNOWN_TRANSACTION;
+ }
+ }
+ } else {
+ ALOGE("Special command sent, but no server object attached.");
}
}
- } else {
- ALOGE("Special command sent, but no server object attached.");
}
}
}