nx_peer_handshake.nx
buildroot/runtime/nx_peer_handshake.nx
about
nx_peer_handshake.nx -- BEP-3 peer-wire HANDSHAKE over a real TCP connection (X-TORRENT-LIVE-001
R4-a): the gateway to BOTH metadata (BEP-9/10) and pieces (BEP-3 request/piece). Wires
nx_peerwire's KAT'd build/parse (nx_pw_build_handshake / nx_pw_parse_handshake / nx_pw_build_msg /
nx_pw_msg_id) to a TCP socket on the nx_syscalls layer (sys_socket SOCK_STREAM + connect/listen/
accept; the UDP analog was nx_udp_tracker_announce). Import nx_peerwire ONLY (pulls nx_syscalls +
_pw_*/nx_pw_* transitively; no double-import). GATE = SOVEREIGN LOOPBACK: a mock peer (TCP
listen+accept on 127.0.0.1, listen-before-fork = no connect race) replies with its handshake
(same info_hash) + a bitfield; the client must parse the handshake (info_hash matches) + receive
the bitfield message. No external net; deterministic; no-hang (socket timeouts). license_tier: ORIGINAL
module: nishi-core.torrent.peer_handshake
depends: nishi-core.torrent.peerwire
dependencies 3 imports · 0 importers
imports: nx_peerwire.nxnx_itoa_lib.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
| 16 | const K_MAGIC_53301: i64 = 53301 |
functions
| 18 | func ph_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 |
| 23 | func ph_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 24 | func ph_sockaddr(sa: *u8, port: i64, i0: i64, i1: i64, i2: i64, i3: i64) -> i64 called by 1: main |
| 32 | func ph_read_n(fd: i64, buf: *u8, n: i64) -> i64 |
| 37 | func ph_write_n(fd: i64, buf: *u8, n: i64) -> i64 called by 1: main |
| 43 | func main() -> i64 |