nx_peer_meta_live.nx
buildroot/runtime/nx_peer_meta_live.nx
about
nx_peer_meta_live.nx -- fetch the REAL torrent metadata from a REAL peer (X-TORRENT-LIVE-001 L3b):
connect a real peer -> BEP-3 handshake -> BEP-10 ext handshake -> BEP-9 ut_metadata fetch (multi-
piece) -> sha1(info-dict)==info_hash -> parse name/piece_length/length. Uses a DISPATCH LOOP (real
peers interleave bitfield/have/choke -- not lockstep). Bounded connect via fork+parent-kill (L3a).
Reuses cl_announce/cl_read_n/cl_write_n/cl_sockaddr (nx_peer_connect_live) + nx_bencode + nx_sha1.
GATE = LIVE: any real peer yields a sha1-verified info-dict for Big Buck Bunny. license_tier: ORIGINAL
module: nishi-core.torrent.peer_meta_live
depends: nishi-core.torrent.peer_connect_live, nishi-core.torrent.bencode, nishi-core.crypto.sha1
dependencies 4 imports · 1 importers
imports: nx_peer_connect_live.nxnx_connect.nxnx_bencode.nxnx_sha1.nx
imported by: nx_peer_piece_live.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const PW_MAGIC_65536: i64 = 65536 |
| 15 | const PW_MAGIC_262144: i64 = 262144 |
| 16 | const PW_MAGIC_40000: i64 = 40000 |
| 17 | const PW_MAGIC_16383: i64 = 16383 |
| 18 | const PW_MAGIC_16384: i64 = 16384 |
| 19 | const PW_MAGIC_12000: i64 = 12000 |
| 21 | const PW_EXT: i64 = 20 |
functions
| 23 | func pm_bstr(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 } |
| 24 | func pm_bint(buf: *u8, off: i64, v: i64) -> i64 |
| 28 | func pm_build_ext(ext_id: i64, data: *u8, dlen: i64, out: *u8) -> i64 |
| 33 | func pm_read_msg(fd: i64, mb: *u8, cap: i64) -> i64 |
| 43 | func pm_child(ipv: i64, port: i64, ih: *u8, mypid: *u8, res: *u8) -> i64 called by 1: main calls 19: sys_socketsys_set_socket_timeoutcl_sockaddrnx_connect_boundednx_pw_build_handshakecl_write_n+13 |
| 133 | func main() -> i64 |