Skip to content

Commit

Permalink
quic: delay calling set_max_concurrent_uni_streams/set_receive_window (
Browse files Browse the repository at this point in the history
…#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)

# Conflicts:
#	streamer/src/nonblocking/quic.rs
  • Loading branch information
alessandrod authored and mergify[bot] committed Apr 22, 2024
1 parent abdb271 commit 39a5ece
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,19 @@ 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,
);

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 {}",
Expand All @@ -367,6 +367,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,
Expand Down

0 comments on commit 39a5ece

Please sign in to comment.