You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make sure applications are compliant with this, we should buffer the inbound streams internally. This allows us to align the buffer size with the ACK backlog.
The interface I'd like to see is:
implConnection<S>{/// Allow the connection to make progress by sending pending frames and reading data from the socket.////// This will buffer up to 256 new inbound streams and immediately reset any additional ones.pubfnpoll(&mutself,cx:&mutContext<'_>) -> Poll<Result<()>>;/// Attempt to open a new outbound stream.////// This will suspend in case we already have 256 unacknowledged outbound streams.pubfnpoll_new_outbound(&mutself,cx:&mutContext<'_>) -> Poll<Result<Stream>>;/// Return the next inbound stream.////// This will return streams from an internal buffer that gets populated as part of [`Connection::poll`]./// In case, the buffer is empty, this will return [`Poll::Pending`].pubfnpoll_next_inbound(&mutself,cx:&mutContext<'_>) -> Poll<Result<Stream>>;}
The text was updated successfully, but these errors were encountered:
I've tried this and I am not sure it is worth the refactoring, will put on hold.
The advantage of the current interface is that it is quite easy to determine when the connection is closed: poll_next_inbound returns None.
With the above interface, it is not obvious that this is what we should do. Because we have ConnectionError::Closed, it is equally feasible for all the above operations to now fail in case the connection is closed.
Once #150 is solved, we more or less have back-pressure in yamux. See libp2p/specs#471 (comment) for an explanation.
To make sure applications are compliant with this, we should buffer the inbound streams internally. This allows us to align the buffer size with the ACK backlog.
The interface I'd like to see is:
The text was updated successfully, but these errors were encountered: