code wiki / _hdl_build / nx_kaprobe.nx

nx_kaprobe.nx

buildroot/runtime/_hdl_build/nx_kaprobe.nx

9402 B203 linesdepth 19pulls 123 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_kaprobe.nx -- HTTP/1.1 KEEP-ALIVE CONNECTION REUSE probe + capability proof (census gap #3: "connection reuse ABSENT: Connection: close ... SOTA keep-alive = 50-80% latency cut for multi-page hosts"). The proven TLS send/recv core (nx_https_req_complete) ALREADY leaves the session CONNECTED after a Content-Length response (cl-stop) with the app-data seq counters advanced -- so a SECOND request over the SAME session/fd just works. The only thing forcing teardown was the request builder's "Connection: close". This organ builds a "Connection: keep-alive" request and measures TWO batches of K GETs to the sovereign edge (loopback 127.0.0.1:8443), both with a WARM cert cache (fair vs the current cache-only production): BATCH A (reuse): 1 handshake + K GETs over ONE session. BATCH B (no-reuse): K (handshake + GET + close) cycles = today's close-per-request behavior. saving = B - A = ~(K-1) handshakes avoided. Emits netobs_keepalive_batch_ms / _noreuse_batch_ms / _saved_ms / _per_req_ms so /netobs tracks the reuse win as a continuous series. Self-diagnosing: if the server does not honor keep-alive (request 2 fails on a torn session) the probe reports VERDICT=RED honestly. Rule 26: read-only network probe, zero hardware writes. Envelope: K=5 GETs/batch, loopback-only, 8s tmo. license_tier: ORIGINAL expect_exit: 0

dependencies 12 imports · 0 importers

nx_sovjson_lib.nx nx_itoa_lib.nx nx_connect.nx nx_syscalls.nx nx_csprng.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_tls13_client_validate_certifica nx_tls13_client_session_run.nx nx_tls13_client_session.nx nx_kaprobe.nx

diagram shows first 10 each side; +2 more imports, +0 more importers in the complete lists below.

imports: nx_sovjson_lib.nxnx_itoa_lib.nxnx_connect.nxnx_syscalls.nxnx_csprng.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_tls13_client_validate_certificate.nxnx_tls13_client_session_run.nxnx_tls13_client_session.nxnx_https_get_complete.nxnx_tls_cert_cache.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_now_realtime_sec sys_mmap sys_clock_gettime_real nx_trust_store_load_from_c sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

27const KA_MAGIC_8443: i64 = 8443
28const KA_MAGIC_4194304: i64 = 4194304
29const KA_MAGIC_1024: i64 = 1024
30const KA_MAGIC_4096: i64 = 4096
32const KA_CERTDATA: *u8 = "data/mozilla_certdata.txt" as *u8
33const KA_CERT_CAP: i64 = 16384
34const KA_OUTCAP: i64 = 262144
35const KA_LEDGER: *u8 = "knowledge/status/netobs_metrics.log"
36const KA_K: i64 = 5

functions

38func ka_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
43func ka_wn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
44func ka_cat(d: *u8, o: i64, s: *u8) -> i64 { return sj_cat(d, o, s) }
called by 2: ka_mrowka_build_request calls 1: sj_cat
45func ka_catn(d: *u8, o: i64, v: i64) -> i64 { return sj_catn(d, o, v) }
called by 1: ka_mrow calls 1: sj_catn
46func ka_mrow(lb: *u8, o: i64, name: *u8, ts: i64, val: i64) -> i64
called by 1: main calls 3: ka_catka_catnsys_now_us
58func ka_append(buf: *u8, n: i64) -> i64
68func ka_build_request(out: *u8, path: *u8, host: *u8) -> i64
called by 1: main calls 1: ka_cat
77func ka_connect() -> i64
96func ka_handshake(store: *TrustStore, host: *u8, hlen: i64, now: i64, fd: i64) -> i64
113func main(argc: i64, argv: *i64) -> i64