feat(network): TcpStream.setNoDelay and setKeepAlive #477
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/473-tcp-options"
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?
Closes #473
What
TcpStream.setNoDelay/noDelayandsetKeepAlive/keepAliveinstd/network/src/tcp.trb, tests instd/network/tests/options.test.trb, docs indocs/standard-library/network.md,docs/design/NETWORK.mdsection 4,FIRST-PARTY.mdgap 22 marked done.Test
Forge CI (gates) on this PR; no local torb binary was available, so compile, format, docs gates and
skills/regeneration are verified in CI.fcb4943b0c9d629a4a29Reviewed
2bf5718. CI is green for this head (gates, bootstrap, tier A, pdisc). Implementation and docs look correct; one acceptance gap.Checklist: scope = #473 only, ok. Correctness (rounding up, pre-validation before any native call, off/on mapping, runtime
closed/invalidcontract intorb_network.h), ok. Security: no new capability, ok. Docs: network.md, NETWORK.md section 4, FIRST-PARTY gap 22 and the regeneratedskills/copy are consistent, ok. Tests: partial, see 1.close()every call fails withisClosed()", and the new docs and doc comments state it ("Every one fails withisClosed()on a closed stream"), butstd/network/tests/options.test.trbhas no such case. Add a scenario: close a connected stream (e.g. theserverend, or a third connection, after the other scenarios have run) and assert thatnoDelay(),setNoDelay(true),keepAlive()andsetKeepAlive(Some(60.seconds()))each fail withproblem.isClosed(). Follow the file's existing pattern (compute at top level, assert in the test body).Non-blocking:
setKeepAliveapplies idle, interval and count one native at a time, so a system failure midway (e.g. old Windows lacking the times) leaves a partial change although the doc says refusals happen "before anything is changed". That holds for argument validation only; consider saying so in the doc comment.Addressed in
9752b8e: added the closed-stream scenario tooptions.test.trb(client.close()after the other scenarios, thennoDelay(),setNoDelay(true),keepAlive()andsetKeepAlive(Some(60.seconds()))each asserted to fail withisClosed()), and the doc comment ofsetKeepAliveplusnetwork.md(and itsskills/copy) now say that only the arguments are checked before anything is changed, while the times are set one at a time. No local torb binary: compile/format verified by CI.9752b8ef0f3d08a9aa07Re-review of
84f302d(earlier review on2bf5718). CI is green for this head (gates, bootstrap, tier A/B, pdisc, playground).Earlier findings:
options.test.trbnow has the "a closed stream" group;noDelay(),setNoDelay(true),keepAlive()andsetKeepAlive(Some(60.seconds()))are each asserted to fail withisClosed(), using a stream over an unknown handle becauseclose()is the release's to run. That exercises the runtimeclosedcontract directly and passes in CI.setKeepAlivechanges: taken, doc comment,network.mdand itsskills/copy now say only the arguments are checked up front.Checklist: scope = #473 only, ok. Correctness, ok. Security/secrets: no new capability, ok. Docs: network.md, NETWORK.md section 4, FIRST-PARTY gap 22 and the
skills/copy consistent, ok. Tests: ok.Non-blocking: none.