diff options
author | 2021-07-15 22:59:34 +0000 | |
---|---|---|
committer | 2021-07-16 00:02:02 +0000 | |
commit | 1b304299ea0f35db0a2e0894665ad29fa3b54e22 (patch) | |
tree | 0b790e3156a26631a900af004eb10a59f0547df5 /libs/binder/RpcSession.cpp | |
parent | fba6f77ac6498aa35cd709ba2aa492d89df02399 (diff) |
libbinder: respect 'reverse' cncts are 'incoming'
Reverse connections are incoming. This probably should have been done as
part of the client/server disambiguation CL, but doing it now.
Bug: N/A
Test: N/A
Change-Id: Ie66e92ccb826bf13094a79bfd38bff260e9c6de6
Diffstat (limited to 'libs/binder/RpcSession.cpp')
-rw-r--r-- | libs/binder/RpcSession.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 8ab2875e92..66b02cb841 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -399,7 +399,7 @@ bool RpcSession::setupSocketClient(const RpcSocketAddress& addr) { mOutgoingConnections.size()); } - if (!setupOneSocketConnection(addr, RpcAddress::zero(), false /*reverse*/)) return false; + if (!setupOneSocketConnection(addr, RpcAddress::zero(), false /*incoming*/)) return false; // TODO(b/189955605): we should add additional sessions dynamically // instead of all at once. @@ -420,7 +420,7 @@ bool RpcSession::setupSocketClient(const RpcSocketAddress& addr) { // we've already setup one client for (size_t i = 0; i + 1 < numThreadsAvailable; i++) { // TODO(b/189955605): shutdown existing connections? - if (!setupOneSocketConnection(addr, mId.value(), false /*reverse*/)) return false; + if (!setupOneSocketConnection(addr, mId.value(), false /*incoming*/)) return false; } // TODO(b/189955605): we should add additional sessions dynamically @@ -430,14 +430,14 @@ bool RpcSession::setupSocketClient(const RpcSocketAddress& addr) { // any requests at all. for (size_t i = 0; i < mMaxThreads; i++) { - if (!setupOneSocketConnection(addr, mId.value(), true /*reverse*/)) return false; + if (!setupOneSocketConnection(addr, mId.value(), true /*incoming*/)) return false; } return true; } bool RpcSession::setupOneSocketConnection(const RpcSocketAddress& addr, const RpcAddress& id, - bool reverse) { + bool incoming) { for (size_t tries = 0; tries < 5; tries++) { if (tries > 0) usleep(10000); @@ -464,7 +464,7 @@ bool RpcSession::setupOneSocketConnection(const RpcSocketAddress& addr, const Rp RpcConnectionHeader header{.options = 0}; memcpy(&header.sessionId, &id.viewRawEmbedded(), sizeof(RpcWireAddress)); - if (reverse) header.options |= RPC_CONNECTION_OPTION_REVERSE; + if (incoming) header.options |= RPC_CONNECTION_OPTION_INCOMING; if (sizeof(header) != TEMP_FAILURE_RETRY(write(serverFd.get(), &header, sizeof(header)))) { int savedErrno = errno; @@ -475,7 +475,7 @@ bool RpcSession::setupOneSocketConnection(const RpcSocketAddress& addr, const Rp LOG_RPC_DETAIL("Socket at %s client with fd %d", addr.toString().c_str(), serverFd.get()); - if (reverse) { + if (incoming) { return addIncomingConnection(std::move(serverFd)); } else { return addOutgoingConnection(std::move(serverFd), true); |