code wiki / _hdl_build / nx_mp_daemon.nx
nx_mp_daemon.nx
buildroot/runtime/_hdl_build/nx_mp_daemon.nx
about
nx_mp_daemon.nx -- sovereign request-handler for the multiplayer player-state relay (the /pstate POST +
/roster GET routes). A LIBRARY (no main) so it is gate-testable without sockets and then dropped into the
socket accept/fork loop (mirrors nx_arcade_serve). The relay lives in SHARED mmap so every forked handler
sees it. Composes nx_room_relay (rr_post) + nx_mp_relay (mp_roster_body). Pure parsing + buffer ops.
/pstate?r=<room>&p=<peer> (POST, body = the wasm's packed snapshot bytes) -> rr_post into the room
/roster?r=<room>&p=<self> (GET) -> mp_roster_body of the OTHER live peers, as an octet-stream body
The browser host does ONLY: snapshot->POST, GET->memcpy->gi_net_ingest_roster. Zero net logic in JS.
license_tier: ORIGINAL
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_mp_relay.nx
imported by: nx_mp_daemon_gate.nxnx_mp_serve.nx
structs
| none |
consts
| 11 | const K_MAGIC_4096: i64 = 4096 |
functions
| 14 | func mpd_path(req: *u8, n: i64, out: *u8) -> i64 |
| 30 | func mpd_starts(s: *u8, pre: *u8) -> i64 called by 1: mpd_route |
| 36 | func mpd_route(path: *u8) -> i64 |
| 41 | func mpd_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: mpd_qint |
| 43 | func mpd_qint(path: *u8, key: *u8) -> i64 |
| 69 | func mpd_body_off(req: *u8, n: i64) -> i64 |
| 77 | func mpd_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 } |
| 78 | func mpd_wn(buf: *u8, off: i64, v: i64) -> i64 |
| 91 | func mpd_pstate(req: *u8, n: i64, path: *u8, st: *i64, arena: *u8, slotb: i64, now: i64, out: *u8) -> i64 |
| 106 | func mpd_roster(path: *u8, st: *i64, arena: *u8, slotb: i64, now: i64, ttl: i64, out: *u8) -> i64 |