From 6ce5829d06bb88383c48d79b5ea6de9b7b3e30d0 Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 11 Dec 2025 12:57:32 +0300 Subject: [PATCH] zapret-auto: override host autostate key --- docs/changes.txt | 1 + lua/zapret-auto.lua | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 75998bd..77d4f70 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -88,3 +88,4 @@ v0.7 * nfqws2: autohostlist: trigger RST and http redirect failures only within specified relative sequence * nfqws2: autohostlist: trigger http redirect failure if payload is http_req without connection proto check * nfqws2: push desync.track.pos.dt as float with nsec accuracy +* zapret-auto: override host autostate key in automate_host_record diff --git a/lua/zapret-auto.lua b/lua/zapret-auto.lua index f98f771..1687f64 100644 --- a/lua/zapret-auto.lua +++ b/lua/zapret-auto.lua @@ -4,9 +4,12 @@ -- failure detectors test potential block conditions for orchestrators -- arg: reqhost - require hostname, do not work with ip +-- arg: key - a string - table name inside autostate table. to allow multiple orchestrator instances to use single host storage function automate_host_record(desync) local key - if desync.arg.reqhost then + if desync.arg.key and #desync.arg.key>0 then + key = desync.arg.key + elseif desync.arg.reqhost then key = desync.track and desync.track.hostname else key = host_or_ip(desync) @@ -15,14 +18,17 @@ function automate_host_record(desync) DLOG("automate: host record key unavailable") return nil end - DLOG("automate: host record key '"..key.."'") + DLOG("automate: host record key 'autostate."..desync.func_instance.."."..key.."'") if not autostate then autostate = {} end - if not autostate[key] then - autostate[key] = {} + if not autostate[desync.func_instance] then + autostate[desync.func_instance] = {} end - return autostate[key] + if not autostate[desync.func_instance][key] then + autostate[desync.func_instance][key] = {} + end + return autostate[desync.func_instance][key] end function automate_conn_record(desync) if not desync.track.lua_state.automate then