Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing the write capacity #1873

Open
ruuda opened this issue Nov 30, 2024 · 3 comments
Open

Exposing the write capacity #1873

ruuda opened this issue Nov 30, 2024 · 3 comments

Comments

@ruuda
Copy link

ruuda commented Nov 30, 2024

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?

@LPardue
Copy link
Contributor

LPardue commented Nov 30, 2024

The amount of stream data that can be buffered is determined by both flow control and congestion control. stream_capacity() returns the minimum of these. Returning either in isolation risks confusing apps about what will subsequently happen.

Possibly one solution is to have a reserve_stream() function. However, it would need to take care to initialize all the relevant internal data structures

@ruuda
Copy link
Author

ruuda commented Nov 30, 2024

Maybe stream_capacity could do the logic for streams that don’t yet exist, and treat them as what their capacity would be after they are created?

@LPardue
Copy link
Contributor

LPardue commented Nov 30, 2024

That would risk breaking existing apps

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

No branches or pull requests

2 participants