Skip to content

feat(stream): add Control::open_stream_on_connection#6487

Open
royzah wants to merge 1 commit into
libp2p:masterfrom
royzah:feat/stream-open-stream-on-connection
Open

feat(stream): add Control::open_stream_on_connection#6487
royzah wants to merge 1 commit into
libp2p:masterfrom
royzah:feat/stream-open-stream-on-connection

Conversation

@royzah

@royzah royzah commented Jun 16, 2026

Copy link
Copy Markdown

Control::open_stream picks one of a peer's connections at random. This adds Control::open_stream_on_connection, which opens an outbound stream on a caller-specified ConnectionId, so a flow can be routed over a chosen connection. It returns io::ErrorKind::NotConnected if that connection is not, or no longer, established.

Additive and non-breaking: open_stream is unchanged. Shared already tracks per-connection senders, so this exposes one via a new Shared::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.

`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>
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

Successfully merging this pull request may close these issues.

1 participant