Skip to content

net: bounded multiplexed streams with credit and cancel (#246) - #258

Open
belikh wants to merge 2 commits into
direct-transportfrom
multiplexed-streams
Open

belikh wants to merge 2 commits into
direct-transportfrom
multiplexed-streams

Conversation

@belikh

@belikh belikh commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements #246 on top of #245.

  • crates/mesh-stream: 16-entry stream table, initiator/responder parity, per-stream byte credit (64 KiB max), 64 KiB queue bound, close/reset, control-first scheduler; no_std + alloc, host tests.
  • Live module uses stream 5 for bulk data and stream 6 for latency control.
  • Bulk credit loop: two chunks granted in the request, two more with Control/WindowUpdate after each consumed pair.
  • GET /mesh/bulk?cancel=1 sends Cancel/Cancel, clears both sides and resets the slot.
  • Rig control-during-bulk and cancel scenarios; no kernel/ROM change.

Evidence

  • cargo test -p mesh-stream: 6 tests (parity/bound, credit exhaustion + control bypass, reset/reclaim, queue bound, control-first scheduling, close transitions).
  • Real direct two-kernel credit run: 64 KiB in 16 x 4 KiB chunks, 191 ms (0.327 MiB/s); baseline 832 ms at 1 KiB.
  • credit_grant counters and WindowUpdate acceptance observed; rejects stayed zero.

Limits

The 8 KiB record path intermittently stalls mid-frame on the shared host; the module fails closed with a partial decoder and the rig records it. The control-during-bulk/cancel end-to-end bundle is therefore an explicit open evidence item, not a pass. No multi-application stream API, no kernel scheduler, no TLS/peer auth.

@github-actions github-actions Bot added area/docs Documentation, specs, ADRs, website size/L 1-2 weeks labels Oct 27, 2026
@belikh
belikh force-pushed the multiplexed-streams branch from 89a703e to a066867 Compare October 27, 2026 04:37
@github-actions github-actions Bot added size/XL More than 2 weeks; split it and removed size/L 1-2 weeks labels Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@belikh
belikh force-pushed the multiplexed-streams branch from 629a050 to 195c2e2 Compare October 27, 2026 05:07
Add crates/mesh-stream: a 16-entry stream table with initiator/responder
parity, per-stream byte credit, a 64 KiB per-stream queue bound, explicit
close/reset and a control-first two-class scheduler.  It is no_std + alloc
and host-tested.

The MCP module uses stream 5 for bulk data and stream 6 for latency control.
The bulk origin grants two chunks in the request and two more with a
Control/WindowUpdate record after each consumed pair.  /mesh/bulk?cancel=1
sends Cancel/Cancel, clears the local transfer and resets the peer stream.

Real direct two-kernel credit run: 64 KiB in 16 x 4 KiB chunks, 191 ms
(0.327 MiB/s) in clean runs against 832 ms for the 1 KiB baseline.  The
control-during-bulk and cancel rig scenarios are implemented; the final
bundle is an explicit open item because the shared host intermittently
stalls a large record mid-frame (the receive deadline fails closed and the
rig records it).  No kernel or ROM change.

Signed-off-by: Jupiter Belic <belikh@users.noreply.github.com>
Signed-off-by: Jupiter Belic <belikh@users.noreply.github.com>
@belikh
belikh force-pushed the multiplexed-streams branch from 195c2e2 to 64ba270 Compare October 27, 2026 05:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation, specs, ADRs, website size/XL More than 2 weeks; split it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant