cloudflare / cloudflare/quiche

Exposing the write capacity

Open
#1,873 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
11.8k
Forks
1.1k
Avg merge
3d 7h
Merged PRs (30d)
16

Description

### Background

I am working on an application, where I have a small-ish number of bytes to send (they usually fit in one UDP packet), and all of those bytes should go in one fresh stream that is marked fin immediately. Due to the way the application is structured, it is very inconvenient to deal with partial writes, so I would like to check beforehand that Quiche can accept the entire write.

### Problem

* We can check whether a new _stream_ can be opened with `peer_streams_left_uni`, but that is no guarantee that we can write all bytes.
* There is `stream_capacity`, but it only works for existing streams, not _new_ streams.
* I suppose I could try to do a zero-length `stream_send` first to ensure the stream exists, and then check its capacity, but this is wasteful because there is a lot of logic in `stream_send` that would be executed twice.

### Ideas

Looking through the implementation of `stream_capacity`, there is `tx_cap`, which looks like exactly what I need. Are there any caveats to exposing it?

Contributor guide

Open the contributing guide

Research direction

Start by reading the implementation of stream_capacity and the tx_cap value it uses, then compare that flow with peer_streams_left_uni and stream_send for newly opened streams. Determine whether capacity can be exposed before writing to a new stream, including any caveats, and document the resulting API behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.