feat(db): Enhance debugging and fix NetId handling
All checks were successful
Build / Build (push) Successful in 30s
All checks were successful
Build / Build (push) Successful in 30s
This commit enhances debugging capabilities and addresses issues related to NetId handling within the DragonflyDB system. Key changes: * **Improved Debugging:** Added more detailed logging in `Utils.cs` to track data chunks and strings, improving the ability to diagnose issues. * **NetId Handling Fix:** Modified `fnc_handler.sqf` to correctly handle NetIds, including a fallback mechanism if the target object is null. This ensures that remote execution attempts don't fail silently. * **Function Examples:** Updated examples in `fnc_hashSetIdBulk.sqf` and `fnc_hashSetBulk.sqf` to correctly use array syntax for function calls. * **Simplified fetch.sqf:** Removed unecessary conversion of the _call variable. * **Binary Updates:** Updated the compiled DLL and SO files.
This commit is contained in:
parent
b05c76edf2
commit
8c64bfe4a9
Binary file not shown.
Binary file not shown.
@ -52,9 +52,7 @@ if (_count_total == _total) then {
|
|||||||
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_fetch' Data String: %1", _dataString];
|
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_fetch' Data String: %1", _dataString];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private _callValue = (_call == "true");
|
[_uniqueID, _function, _call, (parseSimpleArray _dataString), _netId] call FUNC(handler);
|
||||||
|
|
||||||
[_uniqueID, _function, _callValue, (parseSimpleArray _dataString), _netId] call FUNC(handler);
|
|
||||||
|
|
||||||
dragonfly_db_fetch_array = dragonfly_db_fetch_array select {!((_x select 0) in [_uniqueID])};
|
dragonfly_db_fetch_array = dragonfly_db_fetch_array select {!((_x select 0) in [_uniqueID])};
|
||||||
};
|
};
|
@ -32,7 +32,7 @@
|
|||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_uniqueID", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_data", [], [[]]], ["_netId", nil, [""]]];
|
params [["_uniqueID", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_data", [], [[]]], ["_netId", "", [""]]];
|
||||||
|
|
||||||
#ifdef __A3__DEBUG__
|
#ifdef __A3__DEBUG__
|
||||||
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' UniqueID: '%1', Function: '%2', Call: '%3', Data: '%4', NetId: '%5'", _uniqueID, _function, _call, _data, _netId];
|
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' UniqueID: '%1', Function: '%2', Call: '%3', Data: '%4', NetId: '%5'", _uniqueID, _function, _call, _data, _netId];
|
||||||
@ -44,10 +44,34 @@ if (_function == "" || count _data == 0) exitWith {
|
|||||||
|
|
||||||
private _func = call compile format ["%1", _function];
|
private _func = call compile format ["%1", _function];
|
||||||
|
|
||||||
if ((!isNil "_netId") and (_netId isNotEqualTo "")) then {
|
if (_netId != "") then {
|
||||||
private _target = objectFromNetId _netId;
|
private _target = objectFromNetId _netId;
|
||||||
|
|
||||||
if (_call) then { _data remoteExecCall [_function, _target, false]; } else { _data remoteExec [_function, _target, false]; };
|
if (!isNull _target) then {
|
||||||
|
#ifdef __A3__DEBUG__
|
||||||
|
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' Using NetId: '%1'", _netId];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (_call) then {
|
||||||
|
_data remoteExecCall [_function, _target, false];
|
||||||
|
} else {
|
||||||
|
_data remoteExec [_function, _target, false];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
#ifdef __A3__DEBUG__
|
||||||
|
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' NetId '%1' resolved to null object, using local execution", _netId];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (_call) then {
|
||||||
|
_data call _func;
|
||||||
|
} else {
|
||||||
|
_data spawn _func;
|
||||||
|
};
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
if (_call) then { _data call _func; } else { _data spawn _func; };
|
if (_call) then {
|
||||||
|
_data call _func;
|
||||||
|
} else {
|
||||||
|
_data spawn _func;
|
||||||
|
};
|
||||||
};
|
};
|
@ -22,8 +22,8 @@
|
|||||||
* N/A
|
* N/A
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] call dragonfly_db_fnc_hashSetBulk (Server or Singleplayer Only)
|
* [["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call dragonfly_db_fnc_hashSetBulk (Server or Singleplayer Only)
|
||||||
* ["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] remoteExecCall ["dragonfly_db_fnc_hashSetBulk", 2, false] (Multiplayer Only)
|
* [["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] remoteExecCall ["dragonfly_db_fnc_hashSetBulk", 2, false] (Multiplayer Only)
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
* N/A
|
* N/A
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* [getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] call dragonfly_db_fnc_hashSetIdBulk (Server or Singleplayer Only)
|
* [[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call dragonfly_db_fnc_hashSetIdBulk (Server or Singleplayer Only)
|
||||||
* [getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] remoteExecCall ["dragonfly_db_fnc_hashSetIdBulk", 2, false] (Multiplayer Only)
|
* [[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] remoteExecCall ["dragonfly_db_fnc_hashSetIdBulk", 2, false] (Multiplayer Only)
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -50,25 +50,30 @@ namespace ArmaDragonflyClient
|
|||||||
{
|
{
|
||||||
if (!data.StartsWith('['))
|
if (!data.StartsWith('['))
|
||||||
data = BuildArray(data);
|
data = BuildArray(data);
|
||||||
Main.Log($"{data}", "debug");
|
|
||||||
|
Main.Log($"Single chunk data: {data}", "debug");
|
||||||
|
|
||||||
string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call.ToString().ToLower()},{data},\"{entity}\"]";
|
string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call.ToString().ToLower()},{data},\"{entity}\"]";
|
||||||
Main.Log($"{dataAsString}", "debug");
|
|
||||||
|
Main.Log($"Single chunk data string: {dataAsString}", "debug");
|
||||||
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString);
|
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!data.StartsWith('['))
|
if (!data.StartsWith('[') || !data.EndsWith(']'))
|
||||||
data = BuildArray(data);
|
data = BuildArray(data);
|
||||||
Main.Log($"{data}", "debug");
|
|
||||||
|
Main.Log($"Single chunk data: {data}", "debug");
|
||||||
|
|
||||||
var chunks = SplitIntoChunks(data, bufferSize);
|
var chunks = SplitIntoChunks(data, bufferSize);
|
||||||
int totalChunks = chunks.Count;
|
int totalChunks = chunks.Count;
|
||||||
|
|
||||||
for (int i = 0; i < chunks.Count; i++)
|
for (int chunkIndex = 0; chunkIndex < chunks.Count; chunkIndex++)
|
||||||
{
|
{
|
||||||
string escapedChunk = chunks[i].Replace("\"", "\"\"");
|
string escapedChunkData = chunks[chunkIndex].Replace("\"", "\"\"");
|
||||||
string callString = call ? "true" : "false";
|
string chunkAsString = $"[\"{uniqueId}\",\"{function}\",{chunkIndex+1},{totalChunks},\"{escapedChunkData}\",{call.ToString().ToLower()},\"{entity}\"]";
|
||||||
string chunkAsString = $"[\"{uniqueId}\",\"{function}\",{i+1},{totalChunks},\"{escapedChunk}\",\"{callString}\",\"{entity}\"]";
|
|
||||||
|
Main.Log($"Chunk {chunkIndex+1}/{totalChunks}: {chunkAsString}", "debug");
|
||||||
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_fetch", chunkAsString);
|
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_fetch", chunkAsString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,27 +85,33 @@ namespace ArmaDragonflyClient
|
|||||||
{
|
{
|
||||||
if (!data.StartsWith('['))
|
if (!data.StartsWith('['))
|
||||||
data = BuildArray(data);
|
data = BuildArray(data);
|
||||||
Main.Log($"{data}", "debug");
|
|
||||||
|
Main.Log($"Single chunk data: {data}", "debug");
|
||||||
|
|
||||||
string dataAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{data},\"{target}\"]";
|
string dataAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{data},\"{target}\"]";
|
||||||
Main.Log($"{dataAsString}", "debug");
|
|
||||||
|
Main.Log($"Single chunk data: {dataAsString}", "debug");
|
||||||
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubHandler", dataAsString);
|
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubHandler", dataAsString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!data.StartsWith('['))
|
if (!data.StartsWith('['))
|
||||||
data = BuildArray(data);
|
data = BuildArray(data);
|
||||||
Main.Log($"{data}", "debug");
|
|
||||||
|
Main.Log($"Single chunk data: {data}", "debug");
|
||||||
|
|
||||||
var chunks = SplitIntoChunks(data, bufferSize);
|
var chunks = SplitIntoChunks(data, bufferSize);
|
||||||
int totalChunks = chunks.Count;
|
int totalChunks = chunks.Count;
|
||||||
|
|
||||||
for (int i = 0; i < chunks.Count; i++)
|
for (int chunkIndex = 0; chunkIndex < chunks.Count; chunkIndex++)
|
||||||
{
|
{
|
||||||
string escapedChunk = chunks[i].Replace("\"", "\"\"");
|
string escapedChunkData = chunks[chunkIndex].Replace("\"", "\"\"");
|
||||||
string chunkAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{i+1},{totalChunks},\"{escapedChunk}\",\"{target}\"]";
|
string chunkAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{chunkIndex+1},{totalChunks},\"{escapedChunkData}\",\"{target}\"]";
|
||||||
|
|
||||||
|
Main.Log($"Chunk {chunkIndex+1}/{totalChunks}: {chunkAsString}", "debug");
|
||||||
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubFetch", chunkAsString);
|
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubFetch", chunkAsString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user