nx_peer_connect_live.nx
buildroot/runtime/nx_peer_connect_live.nx
about
nx_peer_connect_live.nx -- LIVE BEP-3 handshake with a REAL peer (X-TORRENT-LIVE-001 L3a):
announce -> real peers -> TCP connect + handshake each, validate info_hash. BOUNDED CONNECT (no-
hang law): blocking connect() to an unreachable peer hangs ~127s, so each attempt runs in a FORK
and the PARENT bounds it (WNOHANG poll loop + nx_kill on timeout) -- reliable, no fcntl needed.
Composes nx_dns_a + nx_udp_tracker (announce) + nx_peerwire (handshake). Test = Big Buck Bunny.
GATE = LIVE: any real peer completes the BEP-3 handshake (info_hash matches). license_tier: ORIGINAL
module: nishi-core.torrent.peer_connect_live
depends: nishi-core.torrent.dns_a, nishi-core.torrent.udp_tracker, nishi-core.torrent.peerwire
dependencies 4 imports · 1 importers
imports: nx_dns_a.nxnx_connect.nxnx_udp_tracker.nxnx_peerwire.nx
imported by: nx_peer_meta_live.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const K_MAGIC_305419896: i64 = 305419896 |
| 15 | const K_MAGIC_1000000000: i64 = 1000000000 |
| 16 | const K_MAGIC_6881: i64 = 6881 |
| 17 | const K_MAGIC_2048: i64 = 2048 |
| 18 | const K_MAGIC_6000: i64 = 6000 |
functions
| 20 | func cl_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 } |
| 21 | func cl_wn(fd: i64, v: i64) -> i64 |
| 26 | func cl_sockaddr(sa: *u8, port: i64, i0: i64, i1: i64, i2: i64, i3: i64) -> i64 |
| 33 | func cl_read_n(fd: i64, buf: *u8, n: i64) -> i64 |
| 38 | func cl_write_n(fd: i64, buf: *u8, n: i64) -> i64 |
| 45 | func cl_announce(ih: *u8, pid: *u8, ips: *i64, ports: *i64, max: i64) -> i64 |
| 67 | func cl_child(ipv: i64, port: i64, ih: *u8, mypid: *u8, respath: *u8) -> i64 called by 1: main calls 9: sys_socketsys_set_socket_timeoutcl_sockaddrnx_connect_boundednx_pw_build_handshakecl_write_n+3 |
| 93 | func main() -> i64 |