diff options
| author | 2023-04-04 21:16:14 +0000 | |
|---|---|---|
| committer | 2023-04-04 21:16:14 +0000 | |
| commit | af3a7d09afbdff0b68cc608faffeab0cbd8b33c7 (patch) | |
| tree | 6572c2a4bb2b70057a22a1738f94e9dba1f98319 | |
| parent | 2dbab277bf30686462edb70d48180d3eee54be47 (diff) | |
| parent | a04030b5a10f0cfaaf1698114b84007a029eed55 (diff) | |
Merge "RPC Binder: Shut down the session on disconnect"
| -rw-r--r-- | libs/binder/trusty/RpcServerTrusty.cpp | 14 |
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); |