Skip to content
Merged
Changes from all 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
10 changes: 10 additions & 0 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,16 @@ async fn setup_connection(
stats.clone(),
),
|(pubkey, stake, total_stake, max_stake, min_stake)| {
// The heuristic is that the stake should be large engouh to have 1 stream pass throuh within one throttle
// interval during which we allow max MAX_STREAMS_PER_100MS streams.
let min_stake_ratio = 1_f64 / MAX_STREAMS_PER_100MS as f64;
let stake_ratio = stake as f64 / total_stake as f64;
let stake = if stake_ratio < min_stake_ratio {
// If it is a staked connection with ultra low stake ratio, treat it as unstaked.
0
} else {
stake
};
NewConnectionHandlerParams {
packet_sender,
remote_pubkey: Some(pubkey),
Expand Down