diff options
| author | 2022-01-05 01:32:58 +0000 | |
|---|---|---|
| committer | 2022-01-05 01:32:58 +0000 | |
| commit | 2c25d94025fde6cf7ad80f7a799c7ff7f81b46b6 (patch) | |
| tree | eacdd4bbef7d0f7df0fdd3dcf2c7df85c2e3c57b /libs/binder/RpcSession.cpp | |
| parent | 2692efa2371af720c7d92fddcdb39e8031eea960 (diff) | |
| parent | e627a40c7e4bed19850ee556cb5c4c7300e5b099 (diff) | |
Merge "binder: Eliminate a data copy in RPC transport operations" am: 7dc506f27f am: 8e5a9c89be am: e627a40c7e
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1917958
Change-Id: Idd582e849674945da732d57b004989fade91cddb
Diffstat (limited to 'libs/binder/RpcSession.cpp')
| -rw-r--r-- | libs/binder/RpcSession.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index a5a2bb1017..b84395e7cb 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -615,8 +615,9 @@ status_t RpcSession::initAndAddConnection(unique_fd fd, const std::vector<uint8_ header.options |= RPC_CONNECTION_OPTION_INCOMING; } + iovec headerIov{&header, sizeof(header)}; auto sendHeaderStatus = - server->interruptableWriteFully(mShutdownTrigger.get(), &header, sizeof(header), {}); + server->interruptableWriteFully(mShutdownTrigger.get(), &headerIov, 1, {}); if (sendHeaderStatus != OK) { ALOGE("Could not write connection header to socket: %s", statusToString(sendHeaderStatus).c_str()); @@ -624,9 +625,10 @@ status_t RpcSession::initAndAddConnection(unique_fd fd, const std::vector<uint8_ } if (sessionId.size() > 0) { + iovec sessionIov{const_cast<void*>(static_cast<const void*>(sessionId.data())), + sessionId.size()}; auto sendSessionIdStatus = - server->interruptableWriteFully(mShutdownTrigger.get(), sessionId.data(), - sessionId.size(), {}); + server->interruptableWriteFully(mShutdownTrigger.get(), &sessionIov, 1, {}); if (sendSessionIdStatus != OK) { ALOGE("Could not write session ID ('%s') to socket: %s", base::HexString(sessionId.data(), sessionId.size()).c_str(), |