Skip to content

io: public raw-app stream RESET_STREAM / STOP_SENDING API - #240

Merged
ch4r10t33r merged 1 commit into
masterfrom
feat/raw-app-stream-reset
Jul 5, 2026
Merged

io: public raw-app stream RESET_STREAM / STOP_SENDING API#240
ch4r10t33r merged 1 commit into
masterfrom
feat/raw-app-stream-reset

Conversation

@ch4r10t33r

Copy link
Copy Markdown
Collaborator

Adds an embedder-facing stream-cancel API — the zquic half of the Go transport Reset / CancelRead / CancelWrite surface (used to wire zig-ethp2p's shim streamCancelWrite/streamCancelRead, currently no-ops).

API

  • Server.resetRawAppStream(conn, stream_id, error_code) / Client.resetRawAppStream(stream_id, error_code) — send RESET_STREAM (RFC 9000 §19.4) and drop the local send slot.
  • Server.stopSendingRawAppStream(...) / Client.stopSendingRawAppStream(...) — send STOP_SENDING (§19.5); the existing handler makes the peer reply with RESET_STREAM.
  • StopSending.serialize — the frame previously only had parse.

Receiver side (read parity with Go StreamResetError{Code})

RawAppStreamSlot gains reset_received / reset_error_code, set from both roles' RESET_STREAM handlers (server on conn.raw_app_streams, client on Client.raw_app_recv), and queryable via rawAppStreamResetReceived(conn, sid) / Client.rawAppStreamResetReceived(sid).

Test

Loopback: server opens a raw-app stream, sends data, then resetRawAppStream(…, 42); the client observes the reset with code 42. A negative control confirmed it reads 42 (not a stale/default value). Full zig build test green. Version → 1.7.68.

Adds an embedder-facing stream-cancel API (Go transport `Reset` /
`CancelRead` / `CancelWrite`):

  - Server/Client `resetRawAppStream(stream_id, code)` — send RESET_STREAM
    (RFC 9000 §19.4) and drop the local send slot.
  - Server/Client `stopSendingRawAppStream(stream_id, code)` — send
    STOP_SENDING (§19.5); the peer replies with RESET_STREAM.
  - `StopSending.serialize` (the frame only had `parse`).
  - Receiver side: `RawAppStreamSlot` gains `reset_received` /
    `reset_error_code`, set from both roles' RESET_STREAM handlers, and
    queryable via `rawAppStreamResetReceived` (mirrors Go's
    `StreamResetError{Code}` on read).

Loopback test: the server opens a raw-app stream, sends data, then
`resetRawAppStream(…, 42)`; the client observes the reset with code 42
(negative-controlled). Bumps version to 1.7.68.
@ch4r10t33r
ch4r10t33r merged commit 2d8bc02 into master Jul 5, 2026
10 checks passed
@ch4r10t33r
ch4r10t33r deleted the feat/raw-app-stream-reset branch July 5, 2026 19:35
ch4r10t33r added a commit to blockblaz/zig-ethp2p that referenced this pull request Jul 5, 2026
) (#78)

Bumps zquic to v1.7.68 and connects the shim's previously no-op stream
cancel stubs to zquic's new raw-app reset API:

  - `streamCancelWrite` → RESET_STREAM (Go transport `Reset`/`CancelWrite`)
  - `streamCancelRead`  → STOP_SENDING (Go `CancelRead`), releasing our
    receive obligation / flow-control credit — the peer replies RESET_STREAM
  - `streamResetReceived` → the peer's application error code if it reset the
    stream (read side of Go `StreamResetError{Code}`)

Both are role-aware (client vs server) and now consume the formerly-dead
`Stream.reset_how` as the application error code. The QUIC handshake tests
already drive `streamCancelWrite` via `PeerConn.close`; the RESET_STREAM
round-trip itself is covered by the zquic loopback test in
zigstack/zquic#240.

Together with the earlier `ConnectionStats` change, this lands the concrete
transport-control features from the Go reference. Refs #40.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant