Skip to content

Commit

Permalink
use ConnectionCache without Arc to use BackendConnectionCache
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Lykov committed Feb 6, 2023
1 parent 8e02242 commit b659990
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bench-tps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn create_connection_cache(
client_node_id: &Keypair,
stake: u64,
total_stake: u64,
) -> Arc<ConnectionCache> {
) -> ConnectionCache {
match use_quic {
true => {
let staked_nodes = Arc::new(RwLock::new(StakedNodes::default()));
Expand All @@ -65,9 +65,9 @@ fn create_connection_cache(
Some((&staked_nodes, &client_node_id.pubkey())),
);

Arc::new(connection_cache)
connection_cache
}
false => Arc::new(ConnectionCache::with_udp(tpu_connection_pool_size)),
false => ConnectionCache::with_udp(tpu_connection_pool_size),
}
}

Expand All @@ -81,14 +81,15 @@ fn create_client(
rpc_tpu_sockets: Option<(SocketAddr, SocketAddr)>,
num_nodes: usize,
target_node: Option<Pubkey>,
connection_cache: Arc<ConnectionCache>,
connection_cache: ConnectionCache,
) -> Arc<dyn BenchTpsClient + Send + Sync> {
match external_client_type {
ExternalClientType::RpcClient => Arc::new(RpcClient::new_with_commitment(
json_rpc_url.to_string(),
CommitmentConfig::confirmed(),
)),
ExternalClientType::ThinClient => {
let connection_cache = Arc::new(connection_cache);
if let Some((rpc, tpu)) = rpc_tpu_sockets {
Arc::new(ThinClient::new(rpc, tpu, connection_cache))
} else {
Expand Down

0 comments on commit b659990

Please sign in to comment.