code wiki / (root) / nx_net_polite.nx

nx_net_polite.nx

buildroot/runtime/nx_net_polite.nx

3538 B65 linesdepth 2pulls 2 transitivereach 5 importersview sourcekind librarytopic net
docsdependenciesstructsconstsfunctions

about

nx_net_polite.nx -- INTERNET CITIZENSHIP decisions (pure, deterministic, gate-able): how the harvester paces itself + backs off so it is NOT flagged/blocked/rate-banned (which would dry up our sources). This is the DECISION layer -- the caller (nx_search_extern) composes these around the TLS fetch. Keeps the logic pure so it gates without touching the network. Named thresholds (rule 11, no magic numbers). license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_net_polite.nx nx_frontier_watch.nx nx_net_polite_gate.nx nx_search_extern.nx

imports: nx_syscalls.nx

imported by: nx_frontier_watch.nxnx_net_polite_gate.nxnx_search_extern.nx

structs

none

consts

7const POL_MAX_RETRY: i64 = 3 // give up after this many retries (then honor the block, don't hammer)
8const POL_BACKOFF_BASE_SEC: i64 = 2 // exponential backoff base
9const POL_BACKOFF_CAP_SEC: i64 = 60 // never sleep longer than this per retry
11const POL_ARXIV_MIN_SEC: i64 = 3
12const POL_GITHUB_MIN_SEC: i64 = 6

functions

16func pol_wait_sec(now: i64, last: i64, min_interval: i64) -> i64
called by 2: pol_pacemain
23func pol_backoff_sec(attempt: i64, base: i64, cap: i64) -> i64
30func pol_should_retry(status: i64) -> i64 { if status==429 { return 1 } if status==503 { return 1 } return 0 }
called by 2: mainse_fetch
32func pol_digit(c: i64) -> i64 { if c>=48 { if c<=57 { return 1 } } return 0 }
called by 1: pol_retry_after
33func pol_find_after(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: pol_retry_after
41func pol_retry_after(resp: *u8, n: i64) -> i64
52func pol_pace(last: i64, min_interval: i64) -> i64
59func pol_backoff_sleep(resp: *u8, n: i64, attempt: i64) -> i64