diff --git a/Server_Install_Pack/@epochhive/addons/epoch_server.pbo b/Server_Install_Pack/@epochhive/addons/epoch_server.pbo index 1530d89c..7cf15d91 100644 Binary files a/Server_Install_Pack/@epochhive/addons/epoch_server.pbo and b/Server_Install_Pack/@epochhive/addons/epoch_server.pbo differ diff --git a/Server_Install_Pack/@epochhive/addons/epoch_server_core.pbo b/Server_Install_Pack/@epochhive/addons/epoch_server_core.pbo index cfc88037..befc99dd 100644 Binary files a/Server_Install_Pack/@epochhive/addons/epoch_server_core.pbo and b/Server_Install_Pack/@epochhive/addons/epoch_server_core.pbo differ diff --git a/Server_Install_Pack/@epochhive/addons/epoch_server_settings.pbo b/Server_Install_Pack/@epochhive/addons/epoch_server_settings.pbo index 091d7c06..b8f9a6e1 100644 Binary files a/Server_Install_Pack/@epochhive/addons/epoch_server_settings.pbo and b/Server_Install_Pack/@epochhive/addons/epoch_server_settings.pbo differ diff --git a/Sources/epoch_server/build.hpp b/Sources/epoch_server/build.hpp index cc789314..1edd4aff 100644 --- a/Sources/epoch_server/build.hpp +++ b/Sources/epoch_server/build.hpp @@ -1 +1 @@ -build=709; +build=736; diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_makeSP.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_makeSP.sqf index f810daf5..41d1cdeb 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_makeSP.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_makeSP.sqf @@ -25,7 +25,7 @@ if (alive _jammer) then { _server_vars = _player getVariable["SERVER_VARS", []]; _currentPos = _server_vars param [0,[]]; // invalidate previous position - if (_jammer distance _currentPos > 20) then { _currentPos = [] }; + if (!(_currentPos isEqualTo []) && {_jammer distance _currentPos > 20}) then { _currentPos = [] }; if (_currentPos isEqualTo []) then { // set position of spawnpoint to players SERVER_VARS _server_vars set [0, getposATL _jammer]; // 0 = RESPAWN POS diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf index bf7317c0..182fd4b1 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -300,8 +300,6 @@ for "_i" from 1 to _maxVehicleLimit do { } else { diag_log format["DEBUG: vehicle destroyed already (%2) or invalid vehicle class: %1",_class, _damage]; }; - } else { - diag_log format["DEBUG: invalid vehicle data count: %1 != %2",_arrNum,_dataFormatCount]; }; } else { diag_log format["DEBUG: invalid vehicle data: %1",_response]; diff --git a/Sources/epoch_server/init/server_init.sqf b/Sources/epoch_server/init/server_init.sqf index 42469024..4d7b362c 100644 --- a/Sources/epoch_server/init/server_init.sqf +++ b/Sources/epoch_server/init/server_init.sqf @@ -65,6 +65,7 @@ diag_log "Epoch: Init Variables"; call compile preprocessFileLineNumbers "\epoch_server\init\server_variables.sqf"; call compile preprocessFileLineNumbers "\epoch_server\init\server_securityfunctions.sqf"; + ["I", _instanceID, "86400", ["CONTINUE"]] call EPOCH_fnc_server_hiveSETEX; diag_log format["Epoch: Start Hive, Instance ID: '%1'", _instanceID]; @@ -225,3 +226,6 @@ _sapper setDamage 1; _sapper enableSimulationGlobal false; diag_log format ["Epoch: Server Start Complete: %1 seconds",diag_tickTime-_startTime]; + +// unit test start +// call EPOCH_fnc_server_hiveUnitTest; diff --git a/Sources/epoch_server_core/build.hpp b/Sources/epoch_server_core/build.hpp index cc789314..1edd4aff 100644 --- a/Sources/epoch_server_core/build.hpp +++ b/Sources/epoch_server_core/build.hpp @@ -1 +1 @@ -build=709; +build=736; diff --git a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGET.sqf b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGET.sqf index 029c25f7..71047188 100644 --- a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGET.sqf +++ b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGET.sqf @@ -24,24 +24,18 @@ while {_hiveStatus < 0 || _hiveStatus == 2} do { _hiveStatus = 0; if (_hiveResponse != "") then { _hiveResponse = call compile _hiveResponse; - if !(isNil "_hiveResponse") then { - - if (_hiveResponse isEqualType [] && !(_hiveResponse isEqualTo [])) then { - _hiveStatus = _hiveResponse select 0; - if (_hiveStatus >= 1) then { - _hiveMessage = _hiveMessage + (_hiveResponse select 1); - }; - }; + _hiveResponse params [ + ["_status", 0], + ["_data", ""] + ]; + _hiveStatus = _status; + if (_hiveStatus >= 1) then { + _hiveMessage = _hiveMessage + _data; }; }; }; -if (_hiveStatus > 0 && _hiveMessage find "" == -1) then { - _hiveMessage = call compile _hiveMessage; - if (isNil "_hiveMessage") then { _hiveMessage = [];} -} -else { - _hiveMessage = []; -}; +// note: removed check for null in array _hiveMessage find "" == -1 +_hiveMessage = if (_hiveMessage isEqualTo "") then {[]} else {parseSimpleArray _hiveMessage}; [_hiveStatus, _hiveMessage] diff --git a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETBIT.sqf b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETBIT.sqf index 81474b7f..a6673b22 100644 --- a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETBIT.sqf +++ b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETBIT.sqf @@ -13,19 +13,18 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETBIT.sqf */ -private ["_hiveResponse","_hiveStatus","_hiveMessage"]; +private ["_hiveResponse","_hiveMessage"]; params ["_prefix","_key","_bit"]; - _hiveMessage = false; _hiveResponse = "epochserver" callExtension format["240|%1:%2|%3", _prefix, _key, _bit]; -if (_hiveResponse != "") then { - _hiveResponse = call compile _hiveResponse; - if !(isNil "_hiveResponse") then { - if (_hiveResponse isEqualType [] && !(_hiveResponse isEqualTo[])) then { - if ((_hiveResponse select 0) == 1) then { - _hiveMessage = ((_hiveResponse select 1) == "1"); - }; - }; - }; +if !(_hiveResponse isEqualTo "") then { + _hiveResponse = parseSimpleArray _hiveResponse; + _hiveResponse params [ + ["_status", 0], + ["_data", "0"] + ]; + if (_status == 1) then { + _hiveMessage = (_data isEqualTo "1"); + }; }; _hiveMessage diff --git a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETRANGE.sqf b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETRANGE.sqf index 685df095..102bdac7 100644 --- a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETRANGE.sqf +++ b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETRANGE.sqf @@ -17,50 +17,34 @@ params ["_prefix","_key"]; _hiveMessage = ""; _hiveStatus = 0; - _currentIndex = 0; - _hiveMakeCall = true; +_hiveCharCount = 10000; // get 10k chars while {_hiveMakeCall} do { - - _hiveMakeCall = false; - + _hiveMakeCall = false; // get 10k chars - _currentIndexMax = _currentIndex + 10000; + _currentIndexMax = _currentIndex + _hiveCharCount; _hiveResponse = "epochserver" callExtension format["220|%1:%2|%3|%4", _prefix, _key, _currentIndex, (_currentIndexMax-1)]; - - if (_hiveResponse != "") then { - - _hiveResponse = call compile _hiveResponse; - if !(isNil "_hiveResponse") then{ - - if (_hiveResponse isEqualType [] && !(_hiveResponse isEqualTo[])) then{ - - _hiveStatus = _hiveResponse select 0; - if (_hiveStatus == 1) then{ - - _data = _hiveResponse select 1; - - if !(_data isEqualTo []) then{ - - // add data to string - _hiveMessage = _hiveMessage + _data; - - // if data returned is exactly 10k chars then we likely need to make another call - if (count _data == 10000) then{ - _currentIndex = _currentIndexMax; - _hiveMakeCall = true; - }; - }; - }; - }; - }; - }; + if !(_hiveResponse isEqualTo "") then { + _hiveResponse = call compile _hiveResponse; + _hiveResponse params [ + ["_status", 0], + ["_data", []] + ]; + if (_status isEqualTo 1 && !(_data isEqualTo [])) then{ + // add data to string + _hiveStatus = _status; + _hiveMessage = _hiveMessage + _data; + // if data returned matches exactly _hiveCharCount then we likely need to make another call + if (count _data == _hiveCharCount) then{ + _currentIndex = _currentIndexMax; + _hiveMakeCall = true; + }; + }; + }; }; -if (_hiveStatus == 1) then{ - _hiveMessage = call compile _hiveMessage; - if (isNil "_hiveMessage") then{ _hiveMessage = []; } -}; +// avoid parse if data is blank and return empty array +_hiveMessage = if (_hiveMessage isEqualTo "") then {[]} else {parseSimpleArray _hiveMessage}; [_hiveStatus, _hiveMessage] diff --git a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETTTL.sqf b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETTTL.sqf index f47a8fe8..d1a73550 100644 --- a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETTTL.sqf +++ b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETTTL.sqf @@ -50,12 +50,7 @@ while {_hiveStatus < 0 || _hiveStatus == 2} do { _whileCount = _whileCount + 1; }; -if (_hiveStatus > 0 && _hiveMessage find "" == -1) then { - _hiveMessage = call compile _hiveMessage; - if (isNil "_hiveMessage") then { _hiveMessage = [];} -} -else { - _hiveMessage = []; -}; +// removed check for null in array _hiveMessage find "" == -1 +_hiveMessage = if (_hiveMessage isEqualTo "") then {[]} else {parseSimpleArray _hiveMessage}; [_hiveStatus, _hiveMessage, _hiveTTL] diff --git a/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveUnitTest.sqf b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveUnitTest.sqf new file mode 100644 index 00000000..aebaf1f4 --- /dev/null +++ b/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveUnitTest.sqf @@ -0,0 +1,146 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + For testing callExtension and other DB related updates. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveUnitTest.sqf +*/ +_testID = "1234567890"; +_payload = "32D1ECB8511569B43A5CC39DF4261CACDA912C798B066EE1E1EE06E2F09D02073C1B3FC638F091D58E7691DA7D0F7E1F01371CB58346572A015F6F93429F3BDC"; +_expires = "600"; // 10 minutes +_payload_64k = ""; +_startTime = diag_tickTime; +for "_i" from 1 to 512 do +{ + _payload_64k = _payload_64k + _payload; +}; +_payload_64k_count = count _payload_64k; +diag_log format["DEBUG UNITTEST INIT: _payload count %1",count _payload, (diag_tickTime-_startTime)]; +diag_log format["DEBUG UNITTEST INIT: _payload_64k count %1",_payload_64k_count, (diag_tickTime-_startTime)]; + +_startTime = diag_tickTime; +_response = "epochserver" callExtension ""; +diag_log format ["Epoch UnitTest: version Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// server config instanceID +_startTime = diag_tickTime; +_response = "epochserver" callExtension "000"; +diag_log format ["Epoch UnitTest: 000 Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// time +_startTime = diag_tickTime; +_response = "epochserver" callExtension "510"; +diag_log format ["Epoch UnitTest: 510 Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + + +// SET +_startTime = diag_tickTime; +_response = ["TEST_DATA", _testID, [_payload]] call EPOCH_fnc_server_hiveSET; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveSET Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +// SET 64k +_startTime = diag_tickTime; +_response = ["TEST_DATA_64", _testID, [_payload_64k]] call EPOCH_fnc_server_hiveSET; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveSET 64k Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// SETBIT true +_startTime = diag_tickTime; +_response = ["TEST_BIT_DATA", _testID, 0, 1] call EPOCH_fnc_server_hiveSETBIT; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveSETBIT Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +// SETBIT false +_startTime = diag_tickTime; +_response = ["TEST_BIT_DATA", _testID, 1, 0] call EPOCH_fnc_server_hiveSETBIT; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveSETBIT Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// GETBIT true +_startTime = diag_tickTime; +_response = ["TEST_BIT_DATA", _testID, 0] call EPOCH_fnc_server_hiveGETBIT; +_charCheck = true isEqualTo _response; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGETBIT Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; +// GETBIT false +_startTime = diag_tickTime; +_response = ["TEST_BIT_DATA", _testID, 1] call EPOCH_fnc_server_hiveGETBIT; +_charCheck = false isEqualTo _response; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGETBIT Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; + +// SETEX +_startTime = diag_tickTime; +_response = ["TEST_EXPIRES_DATA", _testID, _expires, [_payload]] call EPOCH_fnc_server_hiveSETEX; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveSETEX Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +// SETEX 64k +_startTime = diag_tickTime; +_response = ["TEST_EXPIRES_DATA_64", _testID, _expires, [_payload_64k]] call EPOCH_fnc_server_hiveSETEX; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveSETEX 64k Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// GET +_startTime = diag_tickTime; +_response = ["TEST_DATA", _testID] call EPOCH_fnc_server_hiveGET; +_response params ["_status","_data"]; +_charCheck = [_payload] isEqualTo _data; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGET Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; +// GET 64k +_startTime = diag_tickTime; +_response = ["TEST_DATA_64", _testID] call EPOCH_fnc_server_hiveGET; +_response params ["_status","_data"]; +_charCheck = [_payload_64k] isEqualTo _data; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGET 64k Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; + +// GETRANGE +_startTime = diag_tickTime; +_response = ["TEST_DATA", _testID] call EPOCH_fnc_server_hiveGETRANGE; +_response params ["_status","_data"]; +_charCheck = [_payload] isEqualTo _data; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGETRANGE Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; +// GETRANGE 64k +_startTime = diag_tickTime; +_response = ["TEST_DATA_64", _testID] call EPOCH_fnc_server_hiveGETRANGE; +_response params ["_status","_data"]; +_charCheck = [_payload_64k] isEqualTo _data; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGETRANGE 64k Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; + +// Expire +_startTime = diag_tickTime; +_response = ["TEST_DATA", _testID, _expires] call EPOCH_fnc_server_hiveEXPIRE; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveEXPIRE Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// GETTTL +_startTime = diag_tickTime; +_response = ["TEST_EXPIRES_DATA", _testID] call EPOCH_fnc_server_hiveGETTTL; +_response params ["_status","_data"]; +_charCheck = [_payload] isEqualTo _data; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGETTTL Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; + +// GETTTL 64k +_startTime = diag_tickTime; +_response = ["TEST_EXPIRES_DATA_64", _testID] call EPOCH_fnc_server_hiveGETTTL; +_response params ["_status","_data"]; +_charCheck = [_payload_64k] isEqualTo _data; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveGETTTL 64k Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)]; + +// Del +_startTime = diag_tickTime; +_response = ["TEST_DATA", _testID] call EPOCH_fnc_server_hiveDEL; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveDEL TEST_DATA Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +_startTime = diag_tickTime; +_response = ["TEST_DATA_64", _testID] call EPOCH_fnc_server_hiveDEL; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveDEL TEST_DATA_64 Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +_startTime = diag_tickTime; +_response = ["TEST_EXPIRES_DATA", _testID] call EPOCH_fnc_server_hiveDEL; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveDEL TEST_EXPIRES_DATA Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +_startTime = diag_tickTime; +_response = ["TEST_EXPIRES_DATA_64", _testID] call EPOCH_fnc_server_hiveDEL; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveDEL TEST_EXPIRES_DATA_64 Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; + +// HIVELOG +_startTime = diag_tickTime; +_response = ['TEST_LOG', _payload] call EPOCH_fnc_server_hiveLog; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveLog Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; +_startTime = diag_tickTime; +_response = ['TEST_LOG', _payload_64k] call EPOCH_fnc_server_hiveLog; +diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveLog 64k Time: %2 : %1 ", _response, (diag_tickTime-_startTime)]; diff --git a/Sources/epoch_server_core/config.cpp b/Sources/epoch_server_core/config.cpp index eaeb64f2..aab44f00 100644 --- a/Sources/epoch_server_core/config.cpp +++ b/Sources/epoch_server_core/config.cpp @@ -41,6 +41,7 @@ class cfgFunctions class server_hiveGETTTL {}; class server_hiveDEL {}; class server_hiveLog {}; + class server_hiveUnitTest {}; }; }; }; diff --git a/Sources/epoch_server_core/treeView.txt b/Sources/epoch_server_core/treeView.txt index 6055f48b..9d6b2ea4 100644 Binary files a/Sources/epoch_server_core/treeView.txt and b/Sources/epoch_server_core/treeView.txt differ diff --git a/Sources/epoch_server_settings/build.hpp b/Sources/epoch_server_settings/build.hpp index cc789314..1edd4aff 100644 --- a/Sources/epoch_server_settings/build.hpp +++ b/Sources/epoch_server_settings/build.hpp @@ -1 +1 @@ -build=709; +build=736; diff --git a/build.txt b/build.txt index 3a89277b..c0dd4fc7 100644 --- a/build.txt +++ b/build.txt @@ -1 +1 @@ -709 +736