zapret-lib,zapret-auto: do not use desync copy to not lose VERDICT_MODIFY changes

This commit is contained in:
bol-van committed 2025-12-10 13:43:39 +03:00
1 parent 5c05c10f83
commit 33ac18ea6b
2 files changed
+6 -5

No files matched your search

+1 -2
View File
@@ -244,12 +244,11 @@ function circular(ctx, desync)
end
DLOG("circular: current strategy "..hrec.nstrategy)
local dcopy = desync_copy(desync)
while true do
local instance = plan_instance_pop(desync)
if not instance then break end
if instance.arg.strategy and tonumber(instance.arg.strategy)==hrec.nstrategy then
verdict = plan_instance_execute(dcopy, verdict, instance)
verdict = plan_instance_execute(desync, verdict, instance)
end
end
+5 -3
View File
@@ -143,6 +143,9 @@ function apply_arg_prefix(desync)
end
end
-- copy instance identification and args from execution plan to desync table
-- NOTE : to not lose VERDICT_MODIFY dissect changes pass original desync table
-- NOTE : if a copy was passed and VERDICT_MODIFY returned you must copy modified dissect back to desync table or resend it and return VERDICT_DROP
-- NOTE : args and some fields are substituted. if you need them - make a copy before calling this.
function apply_execution_plan(desync, instance)
desync.func = instance.func
desync.func_n = instance.func_n
@@ -206,12 +209,11 @@ function desync_copy(desync)
end
-- redo what whould be done without orchestration
function replay_execution_plan(desync)
local dcopy = desync_copy(desync)
local verdict = VERDICT_PASS
while true do
local instance = plan_instance_pop(dcopy)
local instance = plan_instance_pop(desync)
if not instance then break end
verdict = plan_instance_execute(dcopy, verdict, instance)
verdict = plan_instance_execute(desync, verdict, instance)
end
return verdict
end