nx_dist_serve.nx
buildroot/runtime/nx_dist_serve.nx
about
nx_dist_serve.nx -- standalone loopback HTTP server for the hub DOWNLOAD transport: GET /dist/<cid>/<name>
resolves <cid> in /volume1/ai/dist/dist_index.conf (Napster registry) -> the internal source path -> STREAMS the
real bytes (chunked, multi-GB safe) with the correct Content-Length. Content-addressed: the url carries the cid,
the daemon maps cid -> file. ADDITIVE + ISOLATED (new port, touches nothing) -> never-brick by construction;
mirrors nx_fin_serve/nx_tools_api_serve. sites.elf proxies nishifamily.com/dist -> 127.0.0.1:<port>.
nx_dist_serve serve [port] -- accept-loop, serve content by cid
nx_dist_serve probe <port> <path> -- sovereign plain-HTTP self-test of the live round-trip
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_http_server.nxnx_connect.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const DS_MAGIC_1048576: i64 = 1048576 |
| 12 | const DS_MAGIC_8192: i64 = 8192 |
| 13 | const DS_MAGIC_1024: i64 = 1024 |
| 14 | const DS_MAGIC_4096: i64 = 4096 |
| 15 | const DS_MAGIC_65536: i64 = 65536 |
| 16 | const DS_MAGIC_2048: i64 = 2048 |
| 17 | const DS_MAGIC_262144: i64 = 262144 |
| 19 | const DS_PORT_DEFAULT: i64 = 18099 |
| 20 | const DS_IDX: *u8 = "/volume1/ai/dist/dist_index.conf" as *u8 |
functions
| 22 | func ds_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 23 | func ds_puts(s: *u8) -> i64 { sys_write(1, s, ds_slen(s)); return 0 } |
| 24 | func ds_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o } |
| 25 | func ds_catn(dst: *u8, off: i64, v: i64) -> i64 { if v==0 { dst[off]=48 as u8; return off+1 } let t:*u8=sys_mmap(24); var m:i64=v; var k:i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } var o:i64=off; var i:i64=k-1; while i>=0 { dst[o]=t[i]; o=o+1; i=i-1 } return o } |
| 26 | func ds_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c<48 { return v } if c>57 { return v } v=v*10+(c-48); i=i+1 } return v } |
| 27 | func ds_eol(b: *u8, from: i64, blen: i64) -> i64 { var e: i64=from; while e<blen { if b[e]==10 as u8 { return e } e=e+1 } return blen } called by 1: ds_lookup |
| 28 | func ds_tab(b: *u8, from: i64, limit: i64) -> i64 { var e: i64=from; while e<limit { if b[e]==9 as u8 { return e } e=e+1 } return limit } |
| 29 | func ds_memeq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 } called by 1: ds_lookup |
| 30 | func ds_field(row: *u8, rlen: i64, idx: i64, out: *u8) -> i64 { var fs: i64=0; var f: i64=0; while f<idx { let t: i64=ds_tab(row,fs,rlen); fs=t+1; f=f+1 } let fe: i64=ds_tab(row,fs,rlen); var o: i64=0; var k: i64=fs; while k<fe { out[o]=row[k]; o=o+1; k=k+1 } out[o]=0 as u8; return o } |
| 33 | func ds_req_cid(req: *u8, reqlen: i64, out: *u8) -> i64 called by 1: ds_serve |
| 43 | func ds_lookup(cid: *u8, out_src: *u8) -> i64 |
| 62 | func ds_serve(port: i64) -> i64 called by 1: main calls 10: nx_http_server_addr_loopbacknx_http_server_listends_putsds_catds_catnnx_http_server_accept_one+4 |
| 103 | func ds_probe(port: i64, path: *u8) -> i64 called by 1: main calls 7: nx_http_server_addr_loopbacksys_socketds_putsnx_connect_boundedds_catsys_read+1 |
| 118 | func main(argc: i64, argv: *i64) -> i64 |