code wiki / _hdl_build / nx_mp_serve.nx

nx_mp_serve.nx

buildroot/runtime/_hdl_build/nx_mp_serve.nx

7731 B132 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind servicetopic mp
docsdependenciesstructsconstsfunctions

about

nx_mp_serve.nx -- the RUNNABLE sovereign multiplayer daemon: serves the game (pets3d.html + wasm) AND the player-state relay (/pstate POST, /roster GET) on one port. Socket/bind/listen + accept/FORK loop (mirrors nx_arcade_serve, proven live), with the relay in SHARED mmap so every forked handler sees the same rooms. All request logic = nx_mp_daemon (gate-proven). The browser host only memcpy's + calls gi_net_* -- no JS logic. Build: ./_offc/nx_sov_build_run.elf nx_mp_serve (it backgrounds -- the server loops). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_mp_daemon.nx nx_mp_serve.nx

imports: nx_syscalls.nxnx_mp_daemon.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_shared rr_init sys_mmap sys_socket sys_write sys_exit sys_setsockopt sys_bind sys_listen sys_set_socket_timeout sys_mmap ↻ sys_setsockopt ↻ sys_munmap sys_wait4 sys_accept sys_fork sys_close sys_read mpd_path mpd_route mpd_starts sys_now_ms sys_mmap ↻ sys_clock_gettime_mono mpd_pstate mpd_qint mpd_slen mpd_body_off rr_post rr_find rr_alloc mpd_wstr mpd_roster mpd_qint ↻ sys_mmap ↻ mp_roster_body rr_nslots rr_room rr_peer

structs

none

consts

8const MPS_MAGIC_7702: i64 = 7702
9const MPS_MAGIC_8192: i64 = 8192
10const MPS_MAGIC_1024: i64 = 1024
11const MPS_MAGIC_8000: i64 = 8000
21const MPS_MAX_CHILDREN: i64 = 32

functions

23func mps_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
24func mps_wstr(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { buf[off + i] = s[i]; i = i + 1 } return off + i }
called by 1: mps_serve
25func mps_wn(buf: *u8, off: i64, v: i64) -> i64
called by 1: mps_serve calls 1: sys_mmap
32func mps_eq(a: *u8, b: *u8) -> i64
called by 1: main
39func mps_serve(cfd: i64, fpath: *u8, ctype: *u8) -> i64
56func main() -> i64