Skip to content

Commit

Permalink
Development/distributed com (#1767)
Browse files Browse the repository at this point in the history
* [REMOTEHOST] Enable and Test the COMRPC off host.

Phase 1: Start *moving*

* [DISTRIBUTED] Aligning the code to the latest state of the PluginServer.
  • Loading branch information
pwielders authored Oct 2, 2024
1 parent a015de2 commit 79e4ee0
Show file tree
Hide file tree
Showing 15 changed files with 448 additions and 379 deletions.
22 changes: 10 additions & 12 deletions Source/Thunder/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ namespace PluginHost {
Config& operator=(const Config&) = delete;

PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
Config(Core::File& file, const bool background, Core::OptionalType<Core::JSON::Error>& error)
Config(Core::File& file, const bool background, Core::OptionalType<Core::JSON::Error>& error)
: _background(background)
, _prefix()
, _webPrefix()
Expand Down Expand Up @@ -714,18 +714,15 @@ namespace PluginHost {
}
}

bool status = true;
Core::JSON::ArrayType<Plugin::Config::Environment>::ConstIterator index(static_cast<const JSONConfig&>(config).Environments.Elements());
while (index.Next() == true) {
if ((index.Current().Key.IsSet() == true) && (index.Current().Value.IsSet() == true)) {
if (index.Current().Key.IsSet() == false) {
SYSLOG(Logging::Startup, (_T("Failure n setting an environmet variable. Empty key defined!!\n")));
}
else {
string value = _substituter.Substitute(index.Current().Value.Value(), nullptr);
if (value.empty() != true) {
status = Core::SystemInfo::SetEnvironment(index.Current().Key.Value(), value, ((index.Current().Override.Value() == RPC::Object::Environment::Scope::GLOBAL) ? true : false));
if (status != true) {
SYSLOG(Logging::Startup, (_T("Failure in setting Key:Value:[%s]:[%s]\n"), index.Current().Key.Value().c_str(), index.Current().Value.Value().c_str()));
}
} else {
SYSLOG(Logging::Startup, (_T("Failure in Substituting Value of Key:Value:[%s]:[%s]\n"), index.Current().Key.Value().c_str(), index.Current().Value.Value().c_str()));
if (Core::SystemInfo::SetEnvironment(index.Current().Key.Value(), value, ((index.Current().Scope.Value() == RPC::Environment::scope::GLOBAL) ? true : false)) != true) {
SYSLOG(Logging::Startup, (_T("Failure in setting Key:Value:[%s]:[%s]\n"), index.Current().Key.Value().c_str(), index.Current().Value.Value().c_str()));
}
}
}
Expand All @@ -736,11 +733,12 @@ namespace PluginHost {
_plugins = config.Plugins;

Core::JSON::ArrayType<Core::JSON::String>::Iterator itr(config.LinkerPluginPaths.Elements());
while (itr.Next())
while (itr.Next() == true) {
_linkerPluginPaths.push_back(itr.Current().Value());
}
}
}
POP_WARNING()
POP_WARNING()
~Config()
{
ASSERT(_security != nullptr);
Expand Down
5 changes: 3 additions & 2 deletions Source/Thunder/IRemoteInstantiation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace PluginHost {
struct IRemoteInstantiation : virtual public Core::IUnknown {

enum { ID = RPC::IDS::ID_REMOTE_INSTANTIATION };
using IEnvironmentIterator = RPC::IIteratorType<RPC::Object::Environment, RPC::ID_ENVIRONMENT_ITERATOR>;

~IRemoteInstantiation() override = default;

Expand Down Expand Up @@ -58,7 +57,9 @@ namespace PluginHost {
const uint8_t threads,
const int8_t priority,
const string configuration,
IEnvironmentIterator* const& environments) = 0;
RPC::IEnvironmentIterator* const& environments) = 0;

virtual uint32_t Kill (const uint32_t requestId) = 0;
};
}
}
372 changes: 174 additions & 198 deletions Source/Thunder/PluginServer.h

Large diffs are not rendered by default.

42 changes: 22 additions & 20 deletions Source/ThunderPlugin/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
{
}
POP_WARNING()
~Sink() override
{
}
~Sink() override = default;

public:
void Dispatch() {
Expand Down Expand Up @@ -103,7 +101,9 @@ POP_WARNING()

public:
WorkerPoolImplementation() = delete;
WorkerPoolImplementation(WorkerPoolImplementation&&) = delete;
WorkerPoolImplementation(const WorkerPoolImplementation&) = delete;
WorkerPoolImplementation& operator=(WorkerPoolImplementation&&) = delete;
WorkerPoolImplementation& operator=(const WorkerPoolImplementation&) = delete;

PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
Expand Down Expand Up @@ -158,6 +158,12 @@ POP_WARNING()

class ConsoleOptions : public Core::Options {
public:
ConsoleOptions() = delete;
ConsoleOptions(ConsoleOptions&&) = delete;
ConsoleOptions(const ConsoleOptions&&) = delete;
ConsoleOptions& operator= (ConsoleOptions&&) = delete;
ConsoleOptions& operator= (const ConsoleOptions&&) = delete;

ConsoleOptions(int argumentCount, TCHAR* arguments[])
: Core::Options(argumentCount, arguments, _T("h:l:c:C:r:p:s:d:a:m:i:u:g:t:e:E:x:V:v:P:S:f:"))
, Locator(nullptr)
Expand All @@ -182,9 +188,7 @@ POP_WARNING()
{
Parse();
}
~ConsoleOptions()
{
}
~ConsoleOptions() = default;

public:
const TCHAR* Locator;
Expand Down Expand Up @@ -252,12 +256,11 @@ POP_WARNING()
SystemRootPath = Core::Directory::Normalize(Strip(argument));
break;
case 'e':
case 'E': {
Environments.push_back(Plugin::Config::Environment::Info(Strip(argument),
((option == 'E') ? RPC::Object::Environment::Scope::GLOBAL :
RPC::Object::Environment::Scope::LOCAL)));
Environments.emplace_back(RPC::Object::Environment(Strip(argument), RPC::Environment::scope::LOCAL));
break;
case 'E':
Environments.emplace_back(RPC::Object::Environment(Strip(argument), RPC::Environment::scope::GLOBAL));
break;
}
case 'v':
VolatilePath = Core::Directory::Normalize(Strip(argument));
break;
Expand Down Expand Up @@ -651,6 +654,14 @@ int main(int argc, char** argv)

Core::SystemInfo::SetEnvironment(_T("COM_PARENT_INFO"), parentInfo);

for (const auto& info : options.Environments) {
ASSERT (info.Key().empty() == false);
uint32_t status = Core::SystemInfo::SetEnvironment(info.Key(), info.Value().c_str(), ((info.Scope() == RPC::Environment::scope::GLOBAL) ? true : false));
if (status != Core::ERROR_NONE) {
SYSLOG(Logging::Startup, (_T("Failure in setting Key:Value:[%s]:[%s], error: [%d]\n"), info.Key().c_str(), info.Value().c_str(), status));
}
}

Process::ProcessFlow process;

Core::NodeId remoteNode(options.RemoteChannel);
Expand All @@ -674,15 +685,6 @@ int main(int argc, char** argv)
Core::ProcessCurrent().User(string(options.User));
}

for (const auto& info : options.Environments) {
if ((info.key.empty() != true) && (info.value.empty() != true)) {
uint32_t status = Core::SystemInfo::SetEnvironment(info.key, info.value.c_str(), ((info.overriding == RPC::Object::Environment::Scope::GLOBAL) ? true : false));
if (status != true) {
SYSLOG(Logging::Startup, (_T("Failure in setting Key:Value:[%s]:[%s]\n"), info.key.c_str(), info.value.c_str()));
}
}
}

process.Startup(options.Threads, remoteNode, callsign);

// Register an interface to handle incoming requests for interfaces.
Expand Down
2 changes: 2 additions & 0 deletions Source/com/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ set(PUBLIC_HEADERS
Module.h
)

target_compile_options(${TARGET} PRIVATE -Wno-psabi)

target_link_libraries(${TARGET}
PRIVATE
${NAMESPACE}Core::${NAMESPACE}Core
Expand Down
8 changes: 4 additions & 4 deletions Source/com/Communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,11 @@ namespace RPC {

}

ENUM_CONVERSION_BEGIN(RPC::Object::Environment::Scope)
ENUM_CONVERSION_BEGIN(RPC::Environment::scope)

{ RPC::Object::Environment::Scope::LOCAL, _TXT("Local") },
{ RPC::Object::Environment::Scope::GLOBAL, _TXT("Global") },
{ RPC::Environment::scope::LOCAL, _TXT("Local") },
{ RPC::Environment::scope::GLOBAL, _TXT("Global") },

ENUM_CONVERSION_END(RPC::Object::Environment::Scope)
ENUM_CONVERSION_END(RPC::Environment::scope)

}
Loading

0 comments on commit 79e4ee0

Please sign in to comment.