Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunwangs committed Oct 3, 2024
1 parent cca90f8 commit 4e8a09e
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,39 +406,41 @@ async fn run_server(

let client_connection_tracker =
ClientConnectionTracker::new(stats.clone(), max_concurrent_connections);
if client_connection_tracker.is_err() {
stats
.refused_connections_too_many_open_connections
.fetch_add(1, Ordering::Relaxed);
incoming.refuse();
continue;
}
let client_connection_tracker = client_connection_tracker.unwrap();

stats
.outstanding_incoming_connection_attempts
.fetch_add(1, Ordering::Relaxed);
let connecting = incoming.accept();
match connecting {
Ok(connecting) => {
tokio::spawn(setup_connection(
connecting,
client_connection_tracker,
unstaked_connection_table.clone(),
staked_connection_table.clone(),
sender.clone(),
max_connections_per_peer,
staked_nodes.clone(),
max_staked_connections,
max_unstaked_connections,
max_streams_per_ms,
stats.clone(),
wait_for_chunk_timeout,
stream_load_ema.clone(),
));
match client_connection_tracker {
Err(_) => {
stats
.refused_connections_too_many_open_connections
.fetch_add(1, Ordering::Relaxed);
incoming.refuse();
continue;
}
Err(err) => {
debug!("Incoming::accept(): error {:?}", err);
Ok(client_connection_tracker) => {
stats
.outstanding_incoming_connection_attempts
.fetch_add(1, Ordering::Relaxed);
let connecting = incoming.accept();
match connecting {
Ok(connecting) => {
tokio::spawn(setup_connection(
connecting,
client_connection_tracker,
unstaked_connection_table.clone(),
staked_connection_table.clone(),
sender.clone(),
max_connections_per_peer,
staked_nodes.clone(),
max_staked_connections,
max_unstaked_connections,
max_streams_per_ms,
stats.clone(),
wait_for_chunk_timeout,
stream_load_ema.clone(),
));
}
Err(err) => {
debug!("Incoming::accept(): error {:?}", err);
}
}
}
}
} else {
Expand Down Expand Up @@ -1296,9 +1298,8 @@ struct ConnectionEntry {
peer_type: ConnectionPeerType,
last_update: Arc<AtomicU64>,
port: u16,
#[allow(dead_code)]
// We do not explicitly use it, but its drop is triggered when ConnectionEntry is dropped.
client_connection_tracker: ClientConnectionTracker,
_client_connection_tracker: ClientConnectionTracker,
connection: Option<Connection>,
stream_counter: Arc<ConnectionStreamCounter>,
}
Expand All @@ -1318,7 +1319,7 @@ impl ConnectionEntry {
peer_type,
last_update,
port,
client_connection_tracker,
_client_connection_tracker: client_connection_tracker,
connection,
stream_counter,
}
Expand Down

0 comments on commit 4e8a09e

Please sign in to comment.