diff options
author | 2022-03-11 03:49:12 +0000 | |
---|---|---|
committer | 2022-03-30 04:26:54 +0000 | |
commit | 5ad71b5582147f3a26a1986239e1fcd115b81b9a (patch) | |
tree | 0a510b4d52aaeb3883ae5467633b48ed68fe0470 /libs/binder/RpcState.cpp | |
parent | 24350bb0e78ea4f50a59ba06be306c879ddbca10 (diff) |
libbinder: Return status_t from RpcTransport::peek()
Result<> pulls in over 100k of extra libc++ code on Trusty
so this CL replaces it with status_t as the result type of
RpcTransport::peek().
Bug: 224644083
Test: atest binderRpcTest
Change-Id: Idde111245794dc4afd421f3a723feacc8c3a346e
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r-- | libs/binder/RpcState.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index 2e7084e12e..173e30a2e7 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -660,8 +660,14 @@ 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 (connection->rpcTransport->peek(&buf, sizeof(buf)).value_or(0) > 0) { - status_t status = getAndExecuteCommand(connection, session, type); + while (true) { + size_t num_bytes; + status_t status = connection->rpcTransport->peek(&buf, sizeof(buf), &num_bytes); + if (status == WOULD_BLOCK) break; + if (status != OK) return status; + if (!num_bytes) break; + + status = getAndExecuteCommand(connection, session, type); if (status != OK) return status; } return OK; |