Skip to content

Commit

Permalink
v1.18: quic: delay calling set_max_concurrent_uni_streams/set_receive…
Browse files Browse the repository at this point in the history
…_window (backport of #904) (#968)

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 2770424)

Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
  • Loading branch information
mergify[bot] and alessandrod committed Apr 24, 2024
1 parent 8e9969c commit c8b19b3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,10 @@ fn handle_and_cache_new_connection(
params.total_stake,
) as u64)
{
connection.set_max_concurrent_uni_streams(max_uni_streams);
let remote_addr = connection.remote_address();
let receive_window =
compute_recieve_window(params.max_stake, params.min_stake, params.peer_type);

if let Ok(receive_window) = receive_window {
connection.set_receive_window(receive_window);
}

let remote_addr = connection.remote_address();

debug!(
"Peer type {:?}, total stake {}, max streams {} receive_window {:?} from peer {}",
params.peer_type,
Expand All @@ -375,6 +369,12 @@ fn handle_and_cache_new_connection(
)
{
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,
Expand Down

0 comments on commit c8b19b3

Please sign in to comment.