From f203989b7e0ffa207e95109a7534d7b2cd94d2ab Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Tue, 23 Apr 2024 03:56:20 +1000 Subject: [PATCH 1/2] quic: delay calling set_max_concurrent_uni_streams/set_receive_window (#904) * quic: don't call connection.set_max_concurrent_uni_streams if we're going to drop a connection Avoids taking a mutex and waking a task. * quic: don't increase the receive window before we've actually accepted a connection (cherry picked from commit 2770424782bcb07561e101b2f5cb83d1fad9a7b2) # Conflicts: # streamer/src/nonblocking/quic.rs --- streamer/src/nonblocking/quic.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index ba567a7f3123fb..d7cf15cfe47fbd 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -335,6 +335,7 @@ fn handle_and_cache_new_connection( params.total_stake, ) as u64) { +<<<<<<< HEAD connection.set_max_concurrent_uni_streams(max_uni_streams); let receive_window = compute_recieve_window( params.max_stake, @@ -342,12 +343,11 @@ fn handle_and_cache_new_connection( connection_table_l.peer_type, params.stake, ); - - if let Ok(receive_window) = receive_window { - connection.set_receive_window(receive_window); - } - +======= let remote_addr = connection.remote_address(); + let receive_window = + compute_recieve_window(params.max_stake, params.min_stake, params.peer_type); +>>>>>>> 2770424782 (quic: delay calling set_max_concurrent_uni_streams/set_receive_window (#904)) debug!( "Peer type: {:?}, stake {}, total stake {}, max streams {} receive_window {:?} from peer {}", @@ -369,6 +369,12 @@ fn handle_and_cache_new_connection( ) { let peer_type = connection_table_l.peer_type; drop(connection_table_l); + + if let Ok(receive_window) = receive_window { + connection.set_receive_window(receive_window); + } + connection.set_max_concurrent_uni_streams(max_uni_streams); + tokio::spawn(handle_connection( connection, remote_addr, From afba8f415358e0383fdbbbb8d0a9aff9832eca0d Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Tue, 23 Apr 2024 06:08:04 +0000 Subject: [PATCH 2/2] Fix merge conflicts --- streamer/src/nonblocking/quic.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index d7cf15cfe47fbd..67fa42e2d70399 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -335,19 +335,13 @@ fn handle_and_cache_new_connection( params.total_stake, ) as u64) { -<<<<<<< HEAD - connection.set_max_concurrent_uni_streams(max_uni_streams); let receive_window = compute_recieve_window( params.max_stake, params.min_stake, connection_table_l.peer_type, params.stake, ); -======= let remote_addr = connection.remote_address(); - let receive_window = - compute_recieve_window(params.max_stake, params.min_stake, params.peer_type); ->>>>>>> 2770424782 (quic: delay calling set_max_concurrent_uni_streams/set_receive_window (#904)) debug!( "Peer type: {:?}, stake {}, total stake {}, max streams {} receive_window {:?} from peer {}",