/*
Bryan
Exile Server Manager
Threaded loop that consistenly checks if the website has a request. This is written for speed, not readability.
*/
// Send a request to the DLL for a task
_return = parseSimpleArray(["request", []] call ExileServerManager_util_dll_call);
// Make sure we have something to process
if (!(_return select 0)) exitWith { /*if (ESM_DebugEnabled) then { _return call ExileServerManager_util_log; };*/ };
if (ESM_DebugEnabled) then
{
_return call ExileServerManager_util_log;
};
// Get the function
_function = (_return select 1) select 0;
// Get the parameters
_parameters = (_return select 1) select 1;
// Make sure the function is okay
if !(_function in (getArray(configFile >> "CfgESM" >> "functionWhitelist"))) exitWith
{
format["Function %1 called by ESM but it wasn't whitelisted", _function] call ExileServerManager_util_log;
};
// Make sure the function is compiled
if (missionNameSpace getVariable [_function, ""] isEqualTo "") exitWith
{
format["Function %1 called by ESM but it wasn't compiled", _function] call ExileServerManager_util_log;
};
if (ESM_DebugEnabled) then
{
format["Function: %1 with parameters: %2", _function, _parameters] call ExileServerManager_util_log;
};
// I do NOT want this to be blocking. so it means we want to get the hell off this thread ASAP so it can process the next request
_parameters spawn (missionNamespace getVariable [_function, {}]);
true