Skip to content

Commit

Permalink
yamux: document stream ACK backlog (#547)
Browse files Browse the repository at this point in the history
Co-authored-by: Marten Seemann <[email protected]>
  • Loading branch information
thomaseizinger and marten-seemann authored Sep 4, 2023
1 parent 50db89f commit c96c9ec
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions yamux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,19 @@ The Length should be set to one of the following to provide an error code:

## Implementation considerations

### ACK backlog
### ACK backlog & backpressure

Yamux allows for a stream to be opened (and used) before it is acknowledged by the remote.
Yamux also does not specify a backpressure mechanism for opening new streams.

This presents a problem:
A peer must read from the socket and decode the frames to make progress on existing streams.
But any frame could also open yet another stream.

The ACK backlog is defined as the number of streams that a peer has opened which have not yet been acknowledged.
Implementations SHOULD at most allow an ACK backlog of 256 streams.
To support a basic form of backpressure, implementions:

- SHOULD at most allow an ACK backlog of 256 streams.
- MAY buffer unacknowledged inbound streams instead of resetting them when the application currently cannot handle any more streams.
Such a buffer MUST be bounded in size to mitigate DoS attacks.
- MAY delay acknowledging new streams until the application has received or is about to send the first DATA frame.

0 comments on commit c96c9ec

Please sign in to comment.