libbinder: Handle peer closing connection in Trusty
Fix the code handling incoming messages in RpcTransportTipcTrusty
to return DEAD_OBJECT if the peer closed the connection
instead of OK.
Bug: 230135749
Test: binderRpcTest on Trusty
Change-Id: I0ff50e31bd1823bcb568119887453f34c380c1d8
diff --git a/libs/binder/RpcTransportTipcAndroid.cpp b/libs/binder/RpcTransportTipcAndroid.cpp
index 453279c..8b3ddfb 100644
--- a/libs/binder/RpcTransportTipcAndroid.cpp
+++ b/libs/binder/RpcTransportTipcAndroid.cpp
@@ -63,12 +63,14 @@
if (pfd.revents & POLLERR) {
return DEAD_OBJECT;
}
+ if (pfd.revents & POLLIN) {
+ // Copied from FdTrigger.cpp: Even though POLLHUP may also be set,
+ // treat it as a success condition to ensure data is drained.
+ return OK;
+ }
if (pfd.revents & POLLHUP) {
return DEAD_OBJECT;
}
- if (pfd.revents & POLLIN) {
- return OK;
- }
return WOULD_BLOCK;
}