blob: a5096d265bb88c99f93eabe82570b5fd0122fc2b [file]
From a1fc6099bcd693e4039216ec4b8795f72486a252 Mon Sep 17 00:00:00 2001
From: Karunakaran A <Karunakaran_Amirthalingam@cable.comcast.com>
Date: Thu, 7 Apr 2022 16:14:42 +0000
Subject: [PATCH] Revert "ONEM-22659: Synchronization in Release changed"
Source: COMCAST
Upstream-Status: Pending
Signed-off-by: Karunakaran A <Karunakaran_Amirthalingam@cable.comcast.com>
This reverts commit e70fe4856c7cef952238decf9730e8b5283658e5.
---
Source/com/Administrator.cpp | 6 +++++-
Source/com/Administrator.h | 9 +--------
Source/com/IUnknown.h | 17 ++++++++---------
3 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/Source/com/Administrator.cpp b/Source/com/Administrator.cpp
index 0bf3fd89..ec4797f1 100644
--- a/Source/com/Administrator.cpp
+++ b/Source/com/Administrator.cpp
@@ -96,8 +96,10 @@ namespace RPC {
proxy->Complete(response);
}
- void Administrator::UnregisterProxyLocked(const ProxyStub::UnknownProxy& proxy)
+ void Administrator::UnregisterProxy(const ProxyStub::UnknownProxy& proxy)
{
+ _adminLock.Lock();
+
ChannelMap::iterator index(_channelProxyMap.find(proxy.Channel().operator->()));
if (index != _channelProxyMap.end()) {
@@ -116,6 +118,8 @@ namespace RPC {
} else {
TRACE_L1("Could not find the Proxy entry to be unregistered from a channel perspective.");
}
+
+ _adminLock.Unlock();
}
void Administrator::Invoke(Core::ProxyType<Core::IPCChannel>& channel, Core::ProxyType<InvokeMessage>& message)
diff --git a/Source/com/Administrator.h b/Source/com/Administrator.h
index c5050dca..818e6b4b 100644
--- a/Source/com/Administrator.h
+++ b/Source/com/Administrator.h
@@ -240,14 +240,7 @@ namespace RPC {
_adminLock.Unlock();
}
- // should be invoked with already taken lock
- void UnregisterProxyLocked(const ProxyStub::UnknownProxy& proxy);
- void Lock() {
- _adminLock.Lock();
- }
- void UnLock() {
- _adminLock.Unlock();
- }
+ void UnregisterProxy(const ProxyStub::UnknownProxy& proxy);
private:
// ----------------------------------------------------------------------------------------------------
diff --git a/Source/com/IUnknown.h b/Source/com/IUnknown.h
index c5c38821..49d14000 100644
--- a/Source/com/IUnknown.h
+++ b/Source/com/IUnknown.h
@@ -189,7 +189,7 @@ namespace ProxyStub {
}
uint32_t Release() const {
uint32_t result = Core::ERROR_NONE;
- RPC::Administrator::Instance().Lock();
+
_adminLock.Lock();
_refCount--;
@@ -209,24 +209,23 @@ namespace ProxyStub {
message->Parameters().Writer().Number<uint32_t>(_remoteReferences);
// Just try the destruction for few Seconds...
- result = Invoke(message, 2000);
- if (result == Core::ERROR_TIMEDOUT)
- TRACE_L1("Communication timeout");
+ result = Invoke(message, RPC::CommunicationTimeOut);
+
if (result != Core::ERROR_NONE) {
- TRACE_L1("Could not remote release the Proxy result=%d", result);
+ TRACE_L1("Could not remote release the Proxy.");
} else {
// Pass the remote release return value through
result = message->Response().Reader().Number<uint32_t>();
}
}
- // Remove our selves from the Administration, we are done..
- RPC::Administrator::Instance().UnregisterProxyLocked(*this);
_adminLock.Unlock();
- result = Core::ERROR_DESTRUCTION_SUCCEEDED;
+ // Remove our selves from the Administration, we are done..
+ RPC::Administrator::Instance().UnregisterProxy(*this);
+
+ result = (result == Core::ERROR_NONE ? Core::ERROR_DESTRUCTION_SUCCEEDED : result);
}
- RPC::Administrator::Instance().UnLock();
return (result);
}
inline void* RemoteInterface(const uint32_t id) const