feat(stream): add Control::open_stream_on_connection#6487
Open
royzah wants to merge 1 commit into
Open
Conversation
`open_stream` picks one of a peer's connections at random. This adds a variant that opens on a caller-specified connection, so a flow can be routed over a chosen connection/path. `Shared` already tracked per-connection senders; this exposes one via `Shared::sender_on`. Signed-off-by: Royyan Zahir <muhammad.royyan@tii.ae>
e1cc27b to
30c5457
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Control::open_streampicks one of a peer's connections at random. This addsControl::open_stream_on_connection, which opens an outbound stream on a caller-specifiedConnectionId, so a flow can be routed over a chosen connection. It returnsio::ErrorKind::NotConnectedif that connection is not, or no longer, established.Additive and non-breaking:
open_streamis unchanged.Sharedalready tracks per-connection senders, so this exposes one via a newShared::sender_on.Motivation: a multi-path overlay where policy decides which connection carries a given flow and needs to open the stream on that connection rather than a random one.
Tests cover both paths: targeting an existing connection, and erroring on an unknown one.