Make `server::Connection` methods not require `&mut self`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 890
- Forks
- 136
- Avg merge
- 14d 20h
- Merged PRs (30d)
- 2
Description
Currently, many methods in server::Connection require exclusive access, which makes it nigh impossible to concurrently use the connection.
This is not a large problem at the moment, as the only function of interest is the Connection::accept method.
However, when adding support for the H3_DATAGRAM protocol it is not possible to await datagrams and accept requests on the same connection.
I ran into this issue when implementing webtransport in #183, which requires datagram support.
In addition, webtransport has support for multiple sessions per connection, which in order to support requires that the connection can be used both for accepting webtransport datagrams and streams and accepting new requests such as CONNECT.
Simply Arc<Mutex<Connection>> does not solve the issue as the MutexGuard would span an await point on accept.
Making Connection::accept be async fn accept(&self) -> ... would solve the issue. Quinn has a similar api for their accept apis https://docs.rs/quinn/latest/quinn/struct.Connection.html
Is this a change that we are interested in adding? If so, I could work on it.
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 at server::Connection::accept and review the other Connection methods that currently require &mut self, using the H3_DATAGRAM and webtransport context from #183. Compare the intended API with Quinn's accept APIs; done means datagrams, streams, and new requests can be accepted concurrently without holding a mutex across an await point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100