Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose proxies by default #1763

Merged
merged 10 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions Source/Thunder/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,31 +1220,25 @@ namespace Plugin {
{
Core::hresult result = Core::ERROR_UNKNOWN_KEY;

RPC::Administrator::Proxies collection;

// Search for the Dangling proxies
if (RPC::Administrator::Instance().Allocations(linkId, collection) == true) {

using Iterator = IMetadata::Data::IProxiesIterator;

std::list< IMetadata::Data::Proxy> elements;

for (const ProxyStub::UnknownProxy* proxy : collection) {
std::vector<IMetadata::Data::Proxy> collection;
bool proxySearch = RPC::Administrator::Instance().Allocations(linkId, [&collection](const std::vector<ProxyStub::UnknownProxy*>& proxies) {
for (const auto& proxy : proxies) {
IMetadata::Data::Proxy data;
data.Count = proxy->ReferenceCount();
data.Instance = proxy->Implementation();
data.Interface = proxy->InterfaceId();
data.Count = proxy->ReferenceCount();
data.Name = proxy->Name();

elements.emplace_back(std::move(data));
}
collection.emplace_back(std::move(data));
}
});

outProxies = Core::ServiceType<RPC::IteratorType<Iterator>>::Create<Iterator>(std::move(elements));
ASSERT(outProxies != nullptr);
if (proxySearch == true) {
using Iterator = IMetadata::Data::IProxiesIterator;

outProxies = Core::ServiceType<RPC::IteratorType<Iterator>>::Create<Iterator>(std::move(collection));
ASSERT(outProxies != nullptr);
result = Core::ERROR_NONE;
}

return (result);
}

Expand Down
8 changes: 3 additions & 5 deletions Source/Thunder/PluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,15 +712,13 @@ POP_WARNING()
printf("Link: %s\n", index.Current().Remote.Value().c_str());
printf("------------------------------------------------------------\n");

RPC::Administrator::Proxies proxies;

RPC::Administrator::Instance().Allocations(index.Current().ID.Value(), proxies);

for (const ProxyStub::UnknownProxy* proxy : proxies) {
RPC::Administrator::Instance().Allocations(index.Current().ID.Value(), [](const std::vector<ProxyStub::UnknownProxy*>& proxies) {
for (const auto& proxy: proxies) {
pwielders marked this conversation as resolved.
Show resolved Hide resolved
Core::instance_id instanceId = proxy->Implementation();
printf("[%s] InstanceId: 0x%" PRIx64 ", RefCount: %d, InterfaceId %d [0x%X]\n", proxy->Name().c_str(), static_cast<uint64_t>(instanceId), proxy->ReferenceCount(), proxy->InterfaceId(), proxy->InterfaceId());
}
printf("\n");
});
}
}
break;
Expand Down
20 changes: 13 additions & 7 deletions Source/com/Administrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,28 +147,34 @@ namespace RPC {
void DelegatedReleases(const bool enabled) {
_delegatedReleases = enabled;
}
bool Allocations(const uint32_t id, Proxies& proxies) const {

template<typename ACTION>
bool Allocations(const uint32_t id, ACTION&& action) const {
bool found = false;
_adminLock.Lock();
if (id == 0) {
for (const auto& proxy : _channelProxyMap) {
action(proxy.second);
}
action(_danglingProxies);
found = true;
proxies = _danglingProxies;
}
}
else {
ChannelMap::const_iterator index(_channelProxyMap.begin());

while ((found == false) && (index != _channelProxyMap.end())) {

if (index->first != id) {
index++;
}
else {
found = true;
proxies = index->second;
action(index->second);
}
}
}
return (found);
_adminLock.Unlock();
return found;
}

template <typename ACTUALINTERFACE, typename PROXY, typename STUB>
void Announce()
{
Expand Down
Loading