mirror of
https://github.com/bol-van/zapret2.git
synced 2026-10-29 06:02:05 +00:00
zapret-auto: iff/neg in repeater
This commit is contained in:
1 parent
0c4ef51b2a
commit
4cc52b9d24
2 files changed
+13
-1
No files matched your search
+2
-1
@@ -117,6 +117,7 @@ v0.7.4
|
|||||||
|
|
||||||
v0.7.5
|
v0.7.5
|
||||||
|
|
||||||
* zapret-auto : orchestrator "repeater"
|
* zapret-auto: orchestrator "repeater"
|
||||||
* blockcheck2: check http3 with ipv6 exthdr
|
* blockcheck2: check http3 with ipv6 exthdr
|
||||||
* github actions: separate target arm-old with LUA classic, not JIT
|
* github actions: separate target arm-old with LUA classic, not JIT
|
||||||
|
* zapret-auto: iff/neg in repeater
|
||||||
@@ -431,6 +431,8 @@ end
|
|||||||
-- repeat following 'instances' 'repeats' times, execute others with no tampering
|
-- repeat following 'instances' 'repeats' times, execute others with no tampering
|
||||||
-- arg: instances - number of following instances to be repeated. 1 by default
|
-- arg: instances - number of following instances to be repeated. 1 by default
|
||||||
-- arg: repeats - number of repeats
|
-- arg: repeats - number of repeats
|
||||||
|
-- arg: iff - condition function to continue execution. takes desync as arg and returns bool. (cant use 'if' because of reserved word)
|
||||||
|
-- arg: neg - invert condition function result
|
||||||
-- arg: stop - do not replay remaining execution plan after 'instances'
|
-- arg: stop - do not replay remaining execution plan after 'instances'
|
||||||
-- arg: clear - clear execution plan after 'instances'
|
-- arg: clear - clear execution plan after 'instances'
|
||||||
-- test case : --lua-desync=repeater:repeats=2:instances=2 --lua-desync=argdebug:v=1 --lua-desync=argdebug:v=2 --lua-desync=argdebug:v=3
|
-- test case : --lua-desync=repeater:repeats=2:instances=2 --lua-desync=argdebug:v=1 --lua-desync=argdebug:v=2 --lua-desync=argdebug:v=3
|
||||||
@@ -439,7 +441,12 @@ function repeater(ctx, desync)
|
|||||||
if not repeats then
|
if not repeats then
|
||||||
error("repeat: missing 'repeats'")
|
error("repeat: missing 'repeats'")
|
||||||
end
|
end
|
||||||
|
local iff = desync.arg.iff or "cond_true"
|
||||||
|
if type(_G[iff])~="function" then
|
||||||
|
error(name..": invalid 'iff' function '"..iff.."'")
|
||||||
|
end
|
||||||
orchestrate(ctx, desync)
|
orchestrate(ctx, desync)
|
||||||
|
local neg = desync.arg.neg
|
||||||
local stop = desync.arg.stop
|
local stop = desync.arg.stop
|
||||||
local clear = desync.arg.clear
|
local clear = desync.arg.clear
|
||||||
local verdict = VERDICT_PASS
|
local verdict = VERDICT_PASS
|
||||||
@@ -451,6 +458,10 @@ function repeater(ctx, desync)
|
|||||||
-- save plan copy
|
-- save plan copy
|
||||||
local plancopy = deepcopy(desync.plan)
|
local plancopy = deepcopy(desync.plan)
|
||||||
for r=1,repeats do
|
for r=1,repeats do
|
||||||
|
if not logical_xor(_G[iff](desync), neg) then
|
||||||
|
DLOG("repeater: break by iff")
|
||||||
|
break
|
||||||
|
end
|
||||||
DLOG("repeater: "..repinst.." "..r.."/"..repeats)
|
DLOG("repeater: "..repinst.." "..r.."/"..repeats)
|
||||||
-- nested orchestrators can also pop
|
-- nested orchestrators can also pop
|
||||||
local ct_end = #desync.plan - instances
|
local ct_end = #desync.plan - instances
|
||||||
|
|||||||
Reference in new issue
Block a user