-
Notifications
You must be signed in to change notification settings - Fork 492
Simplifying serve function #5902
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
Conversation
In particular, there is no need to parse TLS config upon the reception of every connections.
|
|
||
| loop { | ||
| tokio::select! { | ||
| conn = tcp_listener.accept() => { |
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.
this is not a connection.
| tokio::select! { | ||
| conn = tcp_listener.accept() => { | ||
| let (stream, _remote_addr) = match conn { | ||
| Ok(conn) => conn, |
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.
careful with variable shadowing
| continue; | ||
| }; | ||
|
|
||
| let conn = server.serve_connection_with_upgrades(TokioIo::new(either_stream), service.clone()); |
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.
conn again?
| }; | ||
|
|
||
| let conn = server.serve_connection_with_upgrades(TokioIo::new(either_stream), service.clone()); | ||
| let conn = graceful.watch(conn.into_owned()); |
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.
conn again?
|
|
||
| let either_stream = | ||
| if let Some(tls_config) = &quickwit_services.node_config.rest_config.tls { | ||
| let rustls_config = tls::make_rustls_config(tls_config)?; |
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.
parsing tls config on every connection could be catastrohic. We don't know what code is running there.
In particular, there is no need to parse TLS config upon the reception of every connections. Co-authored-by: fulmicoton <paul.masurel@datadoghq.com>
In particular, there is no need to parse TLS config upon the reception of every connections.