nx_peer_piece_live.nx
buildroot/runtime/nx_peer_piece_live.nx
about
nx_peer_piece_live.nx -- download a REAL data piece from a REAL peer + sha1-verify it against the
metadata piece hash (X-TORRENT-LIVE-001 L4a): the last engine step = real file bytes off the wire.
One peer connection: BEP-3 handshake -> BEP-10 ext -> BEP-9 metadata (piece map) -> INTERESTED ->
on UNCHOKE request piece 0's 16KiB blocks -> assemble -> sha1(piece0)==pieces[0]. DISPATCH state
machine (real peers interleave choke/bitfield/have). Fork-bounded per peer (no-hang). Reuses
nx_peer_meta_live (cl_*/pm_*) + nx_peerwire + nx_bencode + nx_sha1. GATE = LIVE: a real peer serves
a sha1-verified data piece of Big Buck Bunny. license_tier: ORIGINAL
module: nishi-core.torrent.peer_piece_live
depends: nishi-core.torrent.peer_meta_live
dependencies 2 imports · 1 importers
imports: nx_peer_meta_live.nxnx_connect.nx
imported by: nx_torrent_get.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const K_MAGIC_262144: i64 = 262144 |
| 14 | const K_MAGIC_40000: i64 = 40000 |
| 15 | const K_MAGIC_16383: i64 = 16383 |
| 16 | const K_MAGIC_16384: i64 = 16384 |
| 17 | const K_MAGIC_25000: i64 = 25000 |
| 31 | const PCAP: i64 = 33554432 // max piece buffer 32 MiB (was 4 MiB; see seq1734) |
functions
| 34 | func pp_child(ipv: i64, port: i64, ih: *u8, mypid: *u8, res: *u8) -> i64 called by 1: main calls 21: sys_socketsys_set_socket_timeoutcl_sockaddrnx_connect_boundednx_pw_build_handshakecl_write_n+15 |
| 134 | func main() -> i64 |