Networking: polish pass (local-port op, is_alive rename, IP-literal fast path, encapsulation refactor, single-flight DNS) #482
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq#482
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Networking surface — polish pass
Small tidy-ups deferred across the PR1–PR5 networking arc (#477, #478, #479, #480, #481). Each is independently mergeable; bundling them keeps the churn in one PR.
Items
net.tcp.local-port ( Socket -- Int Bool )op (deferred from PR2 #478)No way today to read the OS-assigned port after
net.tcp.listen 0. Integration tests currently hardcode ports as a workaround —tcp-test-port,tcp-test-port-2,tls-test-port-{,-bad,-dns},tcp-test-port-bad. Withlocal-port, tests can bind on0and pick up whatever the OS assigned, ending the magic-number-per-test pattern. Tiny.pool::is_aliverename (deferred from PR4 #480)Reads as a property test, behaves as "safe to reuse." Rename to
is_quietoris_reusable. Adjust the module doc to match. Tiny.IP-literal fast path in DNS resolver call sites (deferred from PR5 #481)
dns::resolve("127.0.0.1")round-trips through the worker-pool channel + LRU cache even thoughgetaddrinfowith the numeric-host arm is trivially fast. Adding ahostname.parse::<IpAddr>().ok()short-circuit at the three call sites —tcp::patch_seq_tcp_connect,udp::patch_seq_udp_send_to,http_client::ssrf::validate_url— is measurable on tight loops, irrelevant otherwise. Worth doing in one pass rather than per-PR.PR5 reviewer's framing:
Tiny.
Encapsulation refactor: move
take_tcp+ install-into-registry back intotcp.rs(deferred from PR3 #479)PR3 promoted
STREAMSandSocketRegistrytopub(crate)sotls.rsandhttp_client/pool.rscould use them. With the surface settled, the take/install pattern can live insidetcp.rsand the registry types can return to fully private — re-localises the "free + allocate is dangerous across a yield" invariant inside the module that owns it.PR3 reviewer's framing:
Small.
Single-flight DNS resolution (deferred from PR1 #477)
N concurrent strands resolving the same uncached host enqueue N separate
getaddrinfojobs today — the cache only collapses sequential fanout. An in-flight map keyed by hostname (HashMap<String, Vec<reply_tx>>) collapses concurrent duplicates onto a single worker job. Cited incrates/runtime/src/dns.rsmodule doc anddocs/STDLIB_REFERENCE.mdnet.dns section as a planned follow-up. Small.Rough scope
Half-day's work. One PR. No design discussion needed; all items are surface-level changes against established APIs.
#486