diff options
Diffstat (limited to 'libs/binder/RpcSession.cpp')
-rw-r--r-- | libs/binder/RpcSession.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 9395b505e1..38958c93cb 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -29,6 +29,7 @@ #include <android-base/hex.h> #include <android-base/macros.h> #include <android_runtime/vm.h> +#include <binder/BpBinder.h> #include <binder/Parcel.h> #include <binder/RpcServer.h> #include <binder/RpcTransportRaw.h> @@ -191,7 +192,7 @@ bool RpcSession::shutdownAndWait(bool wait) { if (wait) { LOG_ALWAYS_FATAL_IF(mShutdownListener == nullptr, "Shutdown listener not installed"); - mShutdownListener->waitForShutdown(_l); + mShutdownListener->waitForShutdown(_l, sp<RpcSession>::fromExisting(this)); LOG_ALWAYS_FATAL_IF(!mThreads.empty(), "Shutdown failed"); } @@ -215,6 +216,10 @@ status_t RpcSession::transact(const sp<IBinder>& binder, uint32_t code, const Pa sp<RpcSession>::fromExisting(this), reply, flags); } +status_t RpcSession::sendDecStrong(const BpBinder* binder) { + return sendDecStrong(binder->getPrivateAccessor().rpcAddress()); +} + status_t RpcSession::sendDecStrong(uint64_t address) { ExclusiveConnection connection; status_t status = ExclusiveConnection::find(sp<RpcSession>::fromExisting(this), @@ -245,17 +250,19 @@ status_t RpcSession::readId() { void RpcSession::WaitForShutdownListener::onSessionAllIncomingThreadsEnded( const sp<RpcSession>& session) { (void)session; - mShutdown = true; } void RpcSession::WaitForShutdownListener::onSessionIncomingThreadEnded() { mCv.notify_all(); } -void RpcSession::WaitForShutdownListener::waitForShutdown(std::unique_lock<std::mutex>& lock) { - while (!mShutdown) { +void RpcSession::WaitForShutdownListener::waitForShutdown(std::unique_lock<std::mutex>& lock, + const sp<RpcSession>& session) { + while (session->mIncomingConnections.size() > 0) { if (std::cv_status::timeout == mCv.wait_for(lock, std::chrono::seconds(1))) { - ALOGE("Waiting for RpcSession to shut down (1s w/o progress)."); + ALOGE("Waiting for RpcSession to shut down (1s w/o progress): %zu incoming connections " + "still.", + session->mIncomingConnections.size()); } } } |