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

Commit 94fcc24

Browse files
committed
expands transport configs in turbine QUIC endpoint
1 parent 78c31aa commit 94fcc24

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

turbine/src/cluster_nodes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ impl From<Pubkey> for NodeId {
423423

424424
#[inline]
425425
pub(crate) fn get_broadcast_protocol(_: &ShredId) -> Protocol {
426-
Protocol::UDP
426+
Protocol::QUIC
427427
}
428428

429429
pub fn make_test_cluster<R: Rng>(

turbine/src/quic_endpoint.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use {
55
log::error,
66
quinn::{
77
ClientConfig, ConnectError, Connecting, Connection, ConnectionError, Endpoint,
8-
EndpointConfig, SendDatagramError, ServerConfig, TokioRuntime, TransportConfig, VarInt,
8+
EndpointConfig, IdleTimeout, SendDatagramError, ServerConfig, TokioRuntime,
9+
TransportConfig, VarInt,
910
},
1011
rcgen::RcgenError,
1112
rustls::{Certificate, PrivateKey},
@@ -39,10 +40,17 @@ use {
3940
const CLIENT_CHANNEL_BUFFER: usize = 1 << 14;
4041
const ROUTER_CHANNEL_BUFFER: usize = 64;
4142
const CONNECTION_CACHE_CAPACITY: usize = 3072;
42-
const INITIAL_MAXIMUM_TRANSMISSION_UNIT: u16 = 1280;
4343
const ALPN_TURBINE_PROTOCOL_ID: &[u8] = b"solana-turbine";
4444
const CONNECT_SERVER_NAME: &str = "solana-turbine";
4545

46+
// Transport config.
47+
const DATAGRAM_RECEIVE_BUFFER_SIZE: usize = 256 * 1024 * 1024;
48+
const DATAGRAM_SEND_BUFFER_SIZE: usize = 128 * 1024 * 1024;
49+
const INITIAL_MAXIMUM_TRANSMISSION_UNIT: u16 = MINIMUM_MAXIMUM_TRANSMISSION_UNIT;
50+
const KEEP_ALIVE_INTERVAL: Duration = Duration::from_secs(4);
51+
const MAX_IDLE_TIMEOUT: Duration = Duration::from_secs(10);
52+
const MINIMUM_MAXIMUM_TRANSMISSION_UNIT: u16 = 1280;
53+
4654
const CONNECTION_CLOSE_ERROR_CODE_SHUTDOWN: VarInt = VarInt::from_u32(1);
4755
const CONNECTION_CLOSE_ERROR_CODE_DROPPED: VarInt = VarInt::from_u32(2);
4856
const CONNECTION_CLOSE_ERROR_CODE_INVALID_IDENTITY: VarInt = VarInt::from_u32(3);
@@ -173,11 +181,18 @@ fn new_client_config(cert: Certificate, key: PrivateKey) -> Result<ClientConfig,
173181
}
174182

175183
fn new_transport_config() -> TransportConfig {
184+
let max_idle_timeout = IdleTimeout::try_from(MAX_IDLE_TIMEOUT).ok();
176185
let mut config = TransportConfig::default();
177186
config
178187
.max_concurrent_bidi_streams(VarInt::from(0u8))
179188
.max_concurrent_uni_streams(VarInt::from(0u8))
180-
.initial_mtu(INITIAL_MAXIMUM_TRANSMISSION_UNIT);
189+
.max_idle_timeout(max_idle_timeout)
190+
.initial_mtu(INITIAL_MAXIMUM_TRANSMISSION_UNIT)
191+
.min_mtu(MINIMUM_MAXIMUM_TRANSMISSION_UNIT)
192+
.mtu_discovery_config(None)
193+
.keep_alive_interval(Some(KEEP_ALIVE_INTERVAL))
194+
.datagram_receive_buffer_size(Some(DATAGRAM_RECEIVE_BUFFER_SIZE))
195+
.datagram_send_buffer_size(DATAGRAM_SEND_BUFFER_SIZE);
181196
config
182197
}
183198

0 commit comments

Comments
 (0)