diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index 38200ea15fe71a..ba567a7f3123fb 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -115,7 +115,9 @@ pub fn spawn_server( coalesce: Duration, ) -> Result<(Endpoint, Arc, JoinHandle<()>), QuicServerError> { info!("Start {name} quic server on {sock:?}"); - let (config, _cert) = configure_server(keypair, gossip_host)?; + let concurrent_connections = max_staked_connections + max_unstaked_connections; + let max_concurrent_connections = concurrent_connections + concurrent_connections / 4; + let (config, _cert) = configure_server(keypair, gossip_host, max_concurrent_connections)?; let endpoint = Endpoint::new( EndpointConfig::default(), diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index 557ffa0977ea35..1f8286c9b3d816 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -56,6 +56,7 @@ impl rustls::server::ClientCertVerifier for SkipClientVerification { pub(crate) fn configure_server( identity_keypair: &Keypair, gossip_host: IpAddr, + max_concurrent_connections: usize, ) -> Result<(ServerConfig, String), QuicServerError> { let (cert, priv_key) = new_self_signed_tls_certificate(identity_keypair, gossip_host)?; let cert_chain_pem_parts = vec![Pem { @@ -71,6 +72,7 @@ pub(crate) fn configure_server( server_tls_config.alpn_protocols = vec![ALPN_TPU_PROTOCOL_ID.to_vec()]; let mut server_config = ServerConfig::with_crypto(Arc::new(server_tls_config)); + server_config.concurrent_connections(max_concurrent_connections as u32); server_config.use_retry(true); let config = Arc::get_mut(&mut server_config.transport).unwrap();