code wiki / _hdl_build / nx_sig2_bp_gate.nx

nx_sig2_bp_gate.nx

buildroot/runtime/_hdl_build/nx_sig2_bp_gate.nx

12481 B266 linesdepth 5pulls 11 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_sig2_bp_gate.nx -- ADVERSARIAL gate for nx_sig2_txq (the relay backpressure fix). Reproduces the EXACT field failure shape the old path had: a receiver that stops reading while the sender floods video-sized frames. OLD behavior: blocking write -> the whole relay stalls (head-of-line), or a partial write tears a frame and poisons the stream. REQUIRED behavior, proven here on REAL sockets with a tiny SO_SNDBUF: T1 NO-STALL : 300 x 8KB sends to a wedged receiver return in bounded wall time; some accepted, the rest dropped WHOLE (never blocks, never tears). T2 INTEGRITY : when the receiver resumes, EVERY accepted frame arrives byte-perfect, in order, exactly once -- the stream parses cleanly end-to-end (no torn frames possible). T3 FAIL-STOP : sends after the receiver dies report fatal (conn reap), no crash (SIGPIPE ignored). T4 FAST PATH : with a live reader, frames go direct (queue stays empty) and all arrive intact. license_tier: ORIGINAL

dependencies 8 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_signal.nx nx_websocket_frame.nx nx_websocket_stream.nx nx_poll.nx nx_sig2_txq.nx nx_gate_verdict.nx nx_sig2_bp_gate.nx

imports: nx_syscalls.nxnx_connect.nxnx_signal.nxnx_websocket_frame.nxnx_websocket_stream.nxnx_poll.nxnx_sig2_txq.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write nx_signal_ignore nx_signal_action_new nx_signal_action_install gv_ctr sys_mmap sys_socket sys_mmap ↻ sys_setsockopt bp_addr sys_bind sys_listen bp_pair sys_socket ↻ sys_mmap ↻ sys_setsockopt ↻ bp_addr ↻ nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll sys_close sys_accept sys_now_us sys_mmap ↻ sys_clock_gettime_mono bp_fill s2tx_send ws_build_header s2tx_drain s2tx_qptr s2tx_wr sys_sendto s2tx_wr ↻ s2tx_qptr ↻ gn sys_mmap ↻

structs

none

consts

none

functions

22func gw(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 calls 1: sys_write
23func gn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
29func bp_addr(a: *u8, port: i64) -> i64
called by 2: bp_pairmain
40func bp_pair(lfd: i64, port: i64, small: i64, out: *i64) -> i64
61func bp_fill(p: *u8, id: i64, n: i64) -> i64
called by 1: main
68func bp_check(p: *u8, n: i64) -> i64 { // returns frame id, or -1 on pattern violation
called by 1: main
77func main() -> i64