diff options
| -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); |