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

AI inspired fixes

This commit is contained in:
bol-van
2026-01-14 09:47:12 +03:00
parent dced388652
commit ca186a6566
2 changed files with 7 additions and 7 deletions

View File

@@ -242,9 +242,9 @@ end
-- if seq is over 2G s and p position comparision can be wrong
function pos_counter_overflow(desync, mode, reverse)
if not desync.track or not desync.track.tcp or (mode~='s' and mode~='p') then return false end
if not desync.track or (mode~='s' and mode~='p') then return false end
local track_pos = reverse and desync.track.pos.reverse or desync.track.pos.direct
return track_pos.tcp.rseq_over_2G
return track_pos.tcp and track_pos.tcp.rseq_over_2G
end
-- these functions duplicate range check logic from C code
-- mode must be n,d,b,s,x,a
@@ -1115,7 +1115,7 @@ end
-- check if desync.outgoing comply with arg.dir or def if it's not present or "out" of they are not present both. dir can be "in","out","any"
function direction_check(desync, def)
local dir = desync.arg.dir or def or "out"
return desync.outgoing and desync.arg.dir~="in" or not desync.outgoing and dir~="out"
return desync.outgoing and dir~="in" or not desync.outgoing and dir~="out"
end
-- if dir "in" or "out" cutoff current desync function from opposite direction
function direction_cutoff_opposite(ctx, desync, def)
@@ -1481,7 +1481,7 @@ function gzip_file(filename, data, expected_ratio, level, memlevel, compress_blo
if not f then
error("gzip_file: "..err)
end
if not write_block_size then compress_block_size=16384 end
if not compress_block_size then compress_block_size=16384 end
if not expected_ratio then expected_ratio=2 end
gz = gzip_init(nil, level, memlevel)

View File

@@ -950,7 +950,7 @@ static int luacall_execution_plan(lua_State *L)
lua_pushf_args(L,&func->args, -1, false);
lua_pushf_str(L,"func", func->func);
lua_pushf_int(L,"func_n", ctx->func_n);
lua_pushf_int(L,"func_n", n);
lua_pushf_str(L,"func_instance", instance);
lua_pushf_range(L,"range", range);
@@ -1449,7 +1449,7 @@ void lua_pushf_ctrack(lua_State *L, const t_ctrack *ctrack, const t_ctrack_posit
lua_pushf_reg(L, "lua_state", ctrack->lua_state);
lua_pushf_bool(L, "lua_in_cutoff", ctrack->b_lua_in_cutoff);
lua_pushf_bool(L, "lua_out_cutoff", ctrack->b_lua_out_cutoff);
lua_pushf_lint(L, "t_start", (lua_Number)ctrack->t_start.tv_sec + ctrack->t_start.tv_nsec/1000000000.);
lua_pushf_number(L, "t_start", (lua_Number)ctrack->t_start.tv_sec + ctrack->t_start.tv_nsec/1000000000.);
lua_pushliteral(L, "pos");
lua_createtable(L, 0, 5);
@@ -3260,7 +3260,7 @@ static void lua_init_const(void)
{"IPTOS_ECN_ECT1",IPTOS_ECN_ECT1},
{"IPTOS_ECN_ECT0",IPTOS_ECN_ECT0},
{"IPTOS_ECN_CE",IPTOS_ECN_CE},
{"IPTOS_DSCP_MASK",0xF0},
{"IPTOS_DSCP_MASK",0xFC},
{"IP6F_MORE_FRAG",0x0001}, // in ip6.h it's defined depending of machine byte order
{"IPV6_FLOWLABEL_MASK",0x000FFFFF},
{"IPV6_FLOWINFO_MASK",0x0FFFFFFF},