webrtc: allow dialing without listening first
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
Currently, the WebRTC implementation requires us to establish a listener before we can dial a connection. See https://github.com/libp2p/rust-libp2p/blob/14530af2611b0cb17179f83802d31c0f28222e91/transports/webrtc/src/tokio/transport.rs#L134.
Not only is this a general short-coming of the implementation, it also complicates things in our interop-tests. In particular, we need to do a Swarm::listen_on before we can perform a dial: https://github.com/zvolin/rust-libp2p/blob/3c833dd6e9d1c069826c889e090f3b11cd4ad355/interop-tests/src/lib.rs#L44-L51
This makes the interop-tests for dial-only transports such as webtransport-websys unnecessarily complicated. This is the reason why we need to feature-gate the listening on cfg(target_arch = "wasm32"). Ideally, we would just move the listening to the is_dialer = false branch but due to the above limitation of the WebRTC transport, that is not possible.
For QUIC, we solve this with a dedicated dialer state: https://github.com/libp2p/rust-libp2p/blob/14530af2611b0cb17179f83802d31c0f28222e91/transports/quic/src/transport.rs#L73-L74
Are you planning to do it yourself in a pull request?
No.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in transports/webrtc/src/tokio/transport.rs at the listener-dependent dialing path, then compare the dedicated dialer state in transports/quic/src/transport.rs. Review interop-tests/src/lib.rs to understand the current listen-before-dial workaround. Done means WebRTC can dial without establishing a listener first and the interop-test workaround is no longer required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100