code wiki / (root) / nx_udp_loopback.nx

nx_udp_loopback.nx

buildroot/runtime/nx_udp_loopback.nx

3831 B82 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic udp
docsdependenciesstructsconstsfunctions

about

nx_udp_loopback.nx -- proves SOVEREIGN UDP sockets on the nx_syscalls (rv64->x86_64) layer, the foundation the tracker announce round-trip (X-TORRENT-LIVE-001 R2b) needs. The existing UDP organs ride OTHER syscall layers (nx_udp.nx -> nx_syscalls_x86_64, net.nx -> syscalls.nx); the tracker build/parse (nx_udp_tracker) is on nx_syscalls.nx, so this proves the round-trip plumbing on THAT layer to avoid a mixed-layer conflict. Pattern (the proven H2 fork-server+client loopback): bind the server socket BEFORE fork (eliminates the bind/send race) + SO_RCV/SNDTIMEO (no-hang law: every recvfrom is bounded). Child = echo server (inherits the bound fd); parent = client; assert the echo round-trips byte-exact over 127.0.0.1. Self-gating. license_tier: ORIGINAL module: nishi-core.torrent.udp_loopback depends: nishi-core.sys.syscalls capability: SOVEREIGN_UDP_ROUNDTRIP

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_udp_loopback.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap ul_sockaddr sys_socket sys_set_socket_timeout sys_mmap ↻ sys_setsockopt sys_munmap sys_bind ul_w sys_write sys_exit sys_fork sys_recvfrom sys_sendto sys_close sys_wait4 ul_wn nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap ↻

structs

none

consts

15const K_MAGIC_53117: i64 = 53117

functions

17func ul_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
22func ul_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
25func ul_sockaddr(sa: *u8, port: i64, i0: i64, i1: i64, i2: i64, i3: i64) -> i64
called by 1: main
34func main() -> i64