diff options
| author | 2021-05-10 23:15:08 +0000 | |
|---|---|---|
| committer | 2021-05-10 23:15:08 +0000 | |
| commit | 4fccd098967a1cad0a188672b801bf4e7b515079 (patch) | |
| tree | 36f7d713d1630b5a7e4cb1df3d7b231c039d599c /libs/binder/RpcServer.cpp | |
| parent | c9fb9f924521162fd1959a99d748b6cb35acbb04 (diff) | |
| parent | b6a1e7eb34980400bdbabcab756c5a244b1f525b (diff) | |
Merge changes Ic0719395,Id9f1b639,I00474797,Ide06476a
* changes:
libbinder: remove RpcState deadlock debug logs
libbinder: RPC avoid abort on too big allocations
libbinder: RPC avoid server shutdown crash
libbinder: delete dead server objects
Diffstat (limited to 'libs/binder/RpcServer.cpp')
| -rw-r--r-- | libs/binder/RpcServer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp index 786e2db3b3..aaebb23f6f 100644 --- a/libs/binder/RpcServer.cpp +++ b/libs/binder/RpcServer.cpp @@ -216,4 +216,16 @@ bool RpcServer::setupSocketServer(const RpcSocketAddress& addr) { return true; } +void RpcServer::onSessionTerminating(const sp<RpcSession>& session) { + auto id = session->mId; + LOG_ALWAYS_FATAL_IF(id == std::nullopt, "Server sessions must be initialized with ID"); + LOG_RPC_DETAIL("Dropping session %d", *id); + + std::lock_guard<std::mutex> _l(mLock); + auto it = mSessions.find(*id); + LOG_ALWAYS_FATAL_IF(it == mSessions.end(), "Bad state, unknown session id %d", *id); + LOG_ALWAYS_FATAL_IF(it->second != session, "Bad state, session has id mismatch %d", *id); + (void)mSessions.erase(it); +} + } // namespace android |