From 6b3fcb080a997983c3cbf83f203dbdaa083e65ac Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Mon, 6 Jan 2025 22:24:29 +0100 Subject: [PATCH] bench-vote, vortexor: Fix build and lint errors (#4303) * All `SocketConfig`'s fields are private, therefore it cannot be constructed with struct literal syntax. Fix that by constructing it with `default()` and calling `reuseport()`. * `SocketConfig` implements `Copy`, so an explicit `clone()` call is unnecessary. * `solana_net_utils::multi_bind_in_range` is deprecated. Use `mutli_bind_in_range_with_config` instead. --- bench-vote/src/main.rs | 6 ++++-- vortexor/src/vortexor.rs | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bench-vote/src/main.rs b/bench-vote/src/main.rs index 998f4020139128..9f515024eb014f 100644 --- a/bench-vote/src/main.rs +++ b/bench-vote/src/main.rs @@ -5,7 +5,7 @@ use { crossbeam_channel::unbounded, solana_client::connection_cache::ConnectionCache, solana_connection_cache::client_connection::ClientConnection, - solana_net_utils::bind_to_unspecified, + solana_net_utils::{bind_to_unspecified, SocketConfig}, solana_sdk::{ hash::Hash, message::Message, signature::Keypair, signer::Signer, transaction::Transaction, }, @@ -139,9 +139,11 @@ fn main() -> Result<()> { let mut read_channels = Vec::new(); let mut read_threads = Vec::new(); let recycler = PacketBatchRecycler::default(); - let (port, read_sockets) = solana_net_utils::multi_bind_in_range( + let config = SocketConfig::default().reuseport(true); + let (port, read_sockets) = solana_net_utils::multi_bind_in_range_with_config( ip_addr, (port, port + num_sockets as u16), + config, num_sockets, ) .unwrap(); diff --git a/vortexor/src/vortexor.rs b/vortexor/src/vortexor.rs index 8a86d15ecec055..21a81c2d06da44 100644 --- a/vortexor/src/vortexor.rs +++ b/vortexor/src/vortexor.rs @@ -54,24 +54,24 @@ impl Vortexor { dynamic_port_range: (u16, u16), num_quic_endpoints: u64, ) -> TpuSockets { - let quic_config = SocketConfig { reuseport: true }; + let quic_config = SocketConfig::default().reuseport(true); let (_, tpu_quic) = - bind_in_range_with_config(bind_address, dynamic_port_range, quic_config.clone()) + bind_in_range_with_config(bind_address, dynamic_port_range, quic_config) .expect("expected bind to succeed"); let tpu_quic_port = tpu_quic.local_addr().unwrap().port(); let tpu_quic = bind_more_with_config( tpu_quic, num_quic_endpoints.try_into().unwrap(), - quic_config.clone(), + quic_config, ) .unwrap(); let (_, tpu_quic_fwd) = bind_in_range_with_config( bind_address, (tpu_quic_port.saturating_add(1), dynamic_port_range.1), - quic_config.clone(), + quic_config, ) .expect("expected bind to succeed");