summaryrefslogtreecommitdiff
path: root/libs/binder/RpcState.cpp
diff options
context:
space:
mode:
author Andrei Homescu <ahomescu@google.com> 2022-03-19 02:34:57 +0000
committer Andrei Homescu <ahomescu@google.com> 2022-05-17 00:58:36 +0000
commit1975aaa532eeeea97980718cd68c4101fcdf6b97 (patch)
treed9158b8b87d7c6288afbfe2dec1547b95b0d3dfd /libs/binder/RpcState.cpp
parent97c1356a08376bd1664a0ce5be5591fe9c91c7d6 (diff)
libbinder: replace RpcTransport::peek() with pollRead()
peek uses MSG_PEEK internally which only works with sockets. This refactors that function into a more specific pollRead() which works for e.g. pipes and other files. Bug: 224644083 Test: atest binderRpcTest Change-Id: I340fa7ee7a7bb2077115fc28835bcadf67db03d9
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r--libs/binder/RpcState.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp
index 6d89064a5d..4ef9cd859d 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -661,13 +661,10 @@ status_t RpcState::getAndExecuteCommand(const sp<RpcSession::RpcConnection>& con
status_t RpcState::drainCommands(const sp<RpcSession::RpcConnection>& connection,
const sp<RpcSession>& session, CommandType type) {
- uint8_t buf;
while (true) {
- size_t num_bytes;
- status_t status = connection->rpcTransport->peek(&buf, sizeof(buf), &num_bytes);
+ status_t status = connection->rpcTransport->pollRead();
if (status == WOULD_BLOCK) break;
if (status != OK) return status;
- if (!num_bytes) break;
status = getAndExecuteCommand(connection, session, type);
if (status != OK) return status;