Skip to content

Commit

Permalink
adds keep-alive-interval to repair QUIC transport config
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri committed Oct 25, 2023
1 parent bd1080b commit 3b35ea0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/src/repair/quic_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use {
log::error,
quinn::{
ClientConfig, ConnectError, Connecting, Connection, ConnectionError, Endpoint,
EndpointConfig, ReadToEndError, RecvStream, SendStream, ServerConfig, TokioRuntime,
TransportConfig, VarInt, WriteError,
EndpointConfig, IdleTimeout, ReadToEndError, RecvStream, SendStream, ServerConfig,
TokioRuntime, TransportConfig, VarInt, WriteError,
},
rcgen::RcgenError,
rustls::{Certificate, PrivateKey},
Expand Down Expand Up @@ -46,7 +46,11 @@ const CONNECT_SERVER_NAME: &str = "solana-repair";
const CLIENT_CHANNEL_BUFFER: usize = 1 << 14;
const ROUTER_CHANNEL_BUFFER: usize = 64;
const CONNECTION_CACHE_CAPACITY: usize = 3072;

// Transport config.
const KEEP_ALIVE_INTERVAL: Duration = Duration::from_secs(4);
const MAX_CONCURRENT_BIDI_STREAMS: VarInt = VarInt::from_u32(512);
const MAX_IDLE_TIMEOUT: Duration = Duration::from_secs(10);

const CONNECTION_CLOSE_ERROR_CODE_SHUTDOWN: VarInt = VarInt::from_u32(1);
const CONNECTION_CLOSE_ERROR_CODE_DROPPED: VarInt = VarInt::from_u32(2);
Expand Down Expand Up @@ -191,11 +195,14 @@ fn new_client_config(cert: Certificate, key: PrivateKey) -> Result<ClientConfig,
}

fn new_transport_config() -> TransportConfig {
let max_idle_timeout = IdleTimeout::try_from(MAX_IDLE_TIMEOUT).unwrap();
let mut config = TransportConfig::default();
config
.datagram_receive_buffer_size(None)
.keep_alive_interval(Some(KEEP_ALIVE_INTERVAL))
.max_concurrent_bidi_streams(MAX_CONCURRENT_BIDI_STREAMS)
.max_concurrent_uni_streams(VarInt::from(0u8))
.datagram_receive_buffer_size(None);
.max_idle_timeout(Some(max_idle_timeout));
config
}

Expand Down

0 comments on commit 3b35ea0

Please sign in to comment.