Skip to content

Conversation

@fulmicoton
Copy link
Collaborator

In particular, there is no need to parse TLS config upon the reception of every connections.

In particular, there is no need to parse TLS config
upon the reception of every connections.

loop {
tokio::select! {
conn = tcp_listener.accept() => {
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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());
Copy link
Collaborator Author

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());
Copy link
Collaborator Author

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)?;
Copy link
Collaborator

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.

@fulmicoton fulmicoton merged commit 185c010 into main Sep 16, 2025
8 checks passed
@fulmicoton fulmicoton deleted the paul.masurel/simplify-serve branch September 16, 2025 15:52
fulmicoton-dd added a commit that referenced this pull request Sep 23, 2025
In particular, there is no need to parse TLS config
upon the reception of every connections.

Co-authored-by: fulmicoton <paul.masurel@datadoghq.com>
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.

4 participants