Skip to content

Normalize one way of checking for frame space #324

Description

@matheus23

Currently we check for frame space in a couple of different ways:

https://github.com/n0-computer/quinn/blob/7663451642bffe9077428c6f7e1cb5c3b4f4da97/quinn-proto/src/connection/mod.rs#L5258-L5262

https://github.com/n0-computer/quinn/blob/7663451642bffe9077428c6f7e1cb5c3b4f4da97/quinn-proto/src/connection/mod.rs#L5295-L5299

And sometimes we don't even compare against a constant:

https://github.com/n0-computer/quinn/blob/7663451642bffe9077428c6f7e1cb5c3b4f4da97/quinn-proto/src/connection/streams/state.rs#L450-L451

We should probably use the same way of doing this in all places.

Comparing non-strict (using < and >) also seems to potentially waste another byte of space in the datagram, IIUC. Since if SIZE_BOUND is exactly equal to the frame space remaining, the frame should (in the worst case) fit into the datagram exactly.


In a PR review I commented some ideas on how we could refactor this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions