Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Fix determination of staked QUIC connections #34760

Merged
merged 4 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions quic-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,21 @@ impl QuicConfig {
}

fn compute_max_parallel_streams(&self) -> usize {
let (client_type, stake, total_stake) =
let (client_type, total_stake) =
self.maybe_client_pubkey
.map_or((ConnectionPeerType::Unstaked, 0, 0), |pubkey| {
.map_or((ConnectionPeerType::Unstaked, 0), |pubkey| {
self.maybe_staked_nodes.as_ref().map_or(
(ConnectionPeerType::Unstaked, 0, 0),
(ConnectionPeerType::Unstaked, 0),
|stakes| {
let rstakes = stakes.read().unwrap();
rstakes.get_node_stake(&pubkey).map_or(
(ConnectionPeerType::Unstaked, 0, rstakes.total_stake()),
|stake| (ConnectionPeerType::Staked, stake, rstakes.total_stake()),
(ConnectionPeerType::Unstaked, rstakes.total_stake()),
|stake| (ConnectionPeerType::Staked(stake), rstakes.total_stake()),
)
},
)
});
compute_max_allowed_uni_streams(client_type, stake, total_stake)
compute_max_allowed_uni_streams(client_type, total_stake)
}

pub fn update_client_certificate(
Expand Down
Loading