-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multitask quic socket operations #611
Conversation
@@ -185,8 +224,37 @@ async fn run_server( | |||
stats.clone(), | |||
coalesce, | |||
)); | |||
|
|||
let mut accepts = incoming |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some comments please on what we are trying to achieve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut accepts = incoming | |
// Create the set of accept() futures we're going to listen on for connections. We wrap quinn's | |
// incoming.accept() so we can store the endpoint index in EndpointAccept::endpoint. When a | |
// future resolves, we use the index to call incoming[index].accept() again. This way we don't | |
// have to recreate the whole set of accept() futures at every loop iteration, saving wakeups | |
// and tokio runtime work. | |
let mut accepts = incoming |
@@ -275,6 +275,9 @@ mod tests { | |||
) | |||
.unwrap(); | |||
|
|||
let response_recv_endpoint = response_recv_endpoints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly related to this PR because pre-change the test is doing the same,
but: why is it using one of the server endpoints? Why isn't it creating a new
endpoint? Makes the test confusing - I had to triple check that it's fine to
just pick one from the now multi-endpoints.
Maybe add a comment that explicitly says that it doesn't really matter which
endpoint is used?
@@ -185,8 +224,37 @@ async fn run_server( | |||
stats.clone(), | |||
coalesce, | |||
)); | |||
|
|||
let mut accepts = incoming |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut accepts = incoming | |
// Create the set of accept() futures we're going to listen on for connections. We wrap quinn's | |
// incoming.accept() so we can store the endpoint index in EndpointAccept::endpoint. When a | |
// future resolves, we use the index to call incoming[index].accept() again. This way we don't | |
// have to recreate the whole set of accept() futures at every loop iteration, saving wakeups | |
// and tokio runtime work. | |
let mut accepts = incoming |
let timeout_connection = select! { | ||
ready = accepts.next() => { | ||
if let Some((connecting, i)) = ready { | ||
accepts.push( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accepts.push( | |
// accept() for socket incoming[i] has resolved. Queue another so we keep | |
// accepting from the socket. | |
accepts.push( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments
Problem
quinn uses a single task to do socket operations. not great
Summary of Changes
use SO_REUSEPORT to fanout socket operation to multiple quinn::Endpoints
Fixes #