summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2023-04-04 21:22:48 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-04-04 21:22:48 +0000
commitabf1161aefc9e6c85ea70fcdecd5538543fa7670 (patch)
tree6572c2a4bb2b70057a22a1738f94e9dba1f98319
parent292338095df8242bc25192e3d12a9ca0dd875f20 (diff)
parentaf3a7d09afbdff0b68cc608faffeab0cbd8b33c7 (diff)
Merge "RPC Binder: Shut down the session on disconnect" am: af3a7d09af
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2515529 Change-Id: I7f157b157acbe51b361270d58bb64506e3f54eb3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/trusty/RpcServerTrusty.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/libs/binder/trusty/RpcServerTrusty.cpp b/libs/binder/trusty/RpcServerTrusty.cpp
index 109da7509a..3a99606ec9 100644
--- a/libs/binder/trusty/RpcServerTrusty.cpp
+++ b/libs/binder/trusty/RpcServerTrusty.cpp
@@ -154,8 +154,18 @@ int RpcServerTrusty::handleMessage(const tipc_port* /*port*/, handle_t /*chan*/,
return NO_ERROR;
}
-void RpcServerTrusty::handleDisconnect(const tipc_port* /*port*/, handle_t /*chan*/,
- void* /*ctx*/) {}
+void RpcServerTrusty::handleDisconnect(const tipc_port* /*port*/, handle_t /*chan*/, void* ctx) {
+ auto* channelContext = reinterpret_cast<ChannelContext*>(ctx);
+ if (channelContext == nullptr) {
+ // Connections marked "incoming" (outgoing from the server's side)
+ // do not have a valid channel context because joinFn does not get
+ // called for them. We ignore them here.
+ return;
+ }
+
+ auto& session = channelContext->session;
+ (void)session->shutdownAndWait(false);
+}
void RpcServerTrusty::handleChannelCleanup(void* ctx) {
auto* channelContext = reinterpret_cast<ChannelContext*>(ctx);