code wiki / (root) / nx_unchoke_gate.nx

nx_unchoke_gate.nx

buildroot/runtime/nx_unchoke_gate.nx

7677 B102 linesdepth 9pulls 42 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_unchoke_gate.nx -- EXECUTION-level proof of the bulk unchoke-patience fix (the seedeval "IGNORING" bug: holders exist but we never pulled). Drives the REAL worker child tg_from_peer against a seeder that stays CHOKED for ~9s (past the old 6s bail) then unchokes. Pre-fix: the child bailed at 6s -> 0 pieces. Post-fix: it keep-alives through the choke, catches the unchoke, downloads byte-perfect. Also exercises the untested keep-alive path (must not corrupt the stream / hang). license_tier: ORIGINAL depends: nx_torrent_get (tg_from_peer), nx_torrent_mkinfo (mk_build_info)

dependencies 2 imports · 0 importers

nx_torrent_get.nx nx_torrent_mkinfo.nx nx_unchoke_gate.nx

imports: nx_torrent_get.nxnx_torrent_mkinfo.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main uc_w uc_mkdir uc_unlink uc_writef sys_openat_wr mk_build_info mk_read_n sys_read mk_slen mk_cat mk_bstr mk_catn mk_catbytes mk_bint mk_catn ↻ cl_sockaddr sys_socket sys_setsockopt sys_bind sys_listen sys_fork sys_accept uc_serve mse_ctx_plain mse_read mw_read_n sys_read ↻ rc4_crypt rc4_prga_byte nx_pw_build_handshake mse_write rc4_crypt ↻ mw_write_n nx_pw_build_msg _pw_put_u32 sys_set_socket_timeout sys_mmap sys_setsockopt ↻ sys_munmap

structs

none

consts

none

functions

10func uc_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
11func uc_n(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(28); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } while k>0 { k=k-1; sys_write(1,(((t as i64)+k) as *u8),1) } return 0 }
called by 1: main
12func uc_mkdir(p: *u8) -> i64 { __syscall(258, AT_FDCWD, p as i64, 0x1ff, 0, 0, 0); return 0 } // mkdirat 0777 (EEXIST harmless)
called by 1: main
14func uc_writef(p: *u8, b: *u8, n: i64) -> i64 { let fd: i64=sys_openat_wr(p, 0x1a4); if fd<0 { return 0-1 } sys_write(fd, b, n); sys_close(fd); return 0 }
called by 1: main calls 1: sys_openat_wr
18func uc_serve(afd: i64, ih: *u8, spid: *u8, srcpath: *u8, plen: i64, total: i64, npc: i64, delay: i64) -> i64
51func main() -> i64