Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

zapret-auto: change function name

This commit is contained in:
bol-van
2025-12-14 13:00:39 +03:00
parent 1e3486ee14
commit e4dd1574b8

View File

@@ -208,13 +208,13 @@ end
-- resets counter if success is detected
-- increases counter if failure is detected
-- returns true if failure counter exceeds threshold
function failure_check(desync, hrec, crec)
function automate_failure_check(desync, hrec, crec)
if crec.nocheck then return false end
local failure_detector, success_detector
if desync.arg.failure_detector then
if type(_G[desync.arg.failure_detector])~="function" then
error("success_failure_check: invalid failure detector function '"..desync.arg.failure_detector.."'")
error("automate_failure_check: invalid failure detector function '"..desync.arg.failure_detector.."'")
end
failure_detector = _G[desync.arg.failure_detector]
else
@@ -222,7 +222,7 @@ function failure_check(desync, hrec, crec)
end
if desync.arg.success_detector then
if type(_G[desync.arg.success_detector])~="function" then
error("success_failure_check: invalid success detector function '"..desync.arg.success_detector.."'")
error("automate_failure_check: invalid success detector function '"..desync.arg.success_detector.."'")
end
success_detector = _G[desync.arg.success_detector]
else
@@ -231,13 +231,13 @@ function failure_check(desync, hrec, crec)
if success_detector(desync, crec) then
crec.nocheck = true
DLOG("failure_check: success detected")
DLOG("automate_failure_check: success detected")
automate_failure_counter_reset(hrec)
return false
end
if failure_detector(desync, crec) then
crec.nocheck = true
DLOG("failure_check: failure detected")
DLOG("automate_failure_check: failure detected")
local fails = tonumber(desync.arg.fails) or 3
local maxtime = tonumber(desync.arg.time) or 60
return automate_failure_counter(hrec, crec, fails, maxtime)
@@ -313,7 +313,7 @@ function circular(ctx, desync)
local verdict = VERDICT_PASS
if hrec.final~=hrec.nstrategy then
local crec = automate_conn_record(desync)
if failure_check(desync, hrec, crec) then
if automate_failure_check(desync, hrec, crec) then
hrec.nstrategy = (hrec.nstrategy % hrec.ctstrategy) + 1
DLOG("circular: rotate strategy to "..hrec.nstrategy)
if hrec.nstrategy == hrec.final then