-
Notifications
You must be signed in to change notification settings - Fork 1k
Remove ThinClient from dos/
#117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,11 @@ use { | |
| crate::{cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo}, | ||
| crossbeam_channel::{unbounded, Sender}, | ||
| rand::{thread_rng, Rng}, | ||
| solana_client::{connection_cache::ConnectionCache, thin_client::ThinClient}, | ||
| solana_client::{ | ||
| connection_cache::ConnectionCache, | ||
| rpc_client::RpcClient, | ||
| tpu_client::{TpuClient, TpuClientConfig, TpuClientWrapper}, | ||
| }, | ||
| solana_perf::recycler::Recycler, | ||
| solana_runtime::bank_forks::BankForks, | ||
| solana_sdk::{ | ||
|
|
@@ -197,35 +201,37 @@ pub fn discover( | |
| #[deprecated(since = "1.18.6", note = "Interface will change")] | ||
| pub fn get_client( | ||
|
CriesofCarrots marked this conversation as resolved.
|
||
| nodes: &[ContactInfo], | ||
| socket_addr_space: &SocketAddrSpace, | ||
| connection_cache: Arc<ConnectionCache>, | ||
| ) -> ThinClient { | ||
| let protocol = connection_cache.protocol(); | ||
| let nodes: Vec<_> = nodes | ||
| .iter() | ||
| .filter_map(|node| node.valid_client_facing_addr(protocol, socket_addr_space)) | ||
| .collect(); | ||
| ) -> TpuClientWrapper { | ||
| let select = thread_rng().gen_range(0..nodes.len()); | ||
| let (rpc, tpu) = nodes[select]; | ||
| ThinClient::new(rpc, tpu, connection_cache) | ||
| } | ||
|
|
||
| #[deprecated(since = "1.18.6", note = "Will be removed in favor of get_client")] | ||
| pub fn get_multi_client( | ||
| nodes: &[ContactInfo], | ||
| socket_addr_space: &SocketAddrSpace, | ||
| connection_cache: Arc<ConnectionCache>, | ||
| ) -> (ThinClient, usize) { | ||
| let protocol = connection_cache.protocol(); | ||
| let (rpc_addrs, tpu_addrs): (Vec<_>, Vec<_>) = nodes | ||
| .iter() | ||
| .filter_map(|node| node.valid_client_facing_addr(protocol, socket_addr_space)) | ||
| .unzip(); | ||
| let num_nodes = tpu_addrs.len(); | ||
| ( | ||
| ThinClient::new_from_addrs(rpc_addrs, tpu_addrs, connection_cache), | ||
| num_nodes, | ||
| ) | ||
|
Comment on lines
-220
to
-228
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems to be spinning up rpc multiple clients under the wrapper of a |
||
| let rpc_pubsub_url = format!("ws://{}/", nodes[select].rpc_pubsub().unwrap()); | ||
| let rpc_url = format!("http://{}", nodes[select].rpc().unwrap()); | ||
|
|
||
| match &*connection_cache { | ||
| ConnectionCache::Quic(cache) => TpuClientWrapper::Quic( | ||
| TpuClient::new_with_connection_cache( | ||
| Arc::new(RpcClient::new(rpc_url)), | ||
| rpc_pubsub_url.as_str(), | ||
| TpuClientConfig::default(), | ||
| cache.clone(), | ||
| ) | ||
| .unwrap_or_else(|err| { | ||
| panic!("Could not create TpuClient with Quic Cache {err:?}"); | ||
| }), | ||
| ), | ||
| ConnectionCache::Udp(cache) => TpuClientWrapper::Udp( | ||
| TpuClient::new_with_connection_cache( | ||
| Arc::new(RpcClient::new(rpc_url)), | ||
| rpc_pubsub_url.as_str(), | ||
| TpuClientConfig::default(), | ||
| cache.clone(), | ||
| ) | ||
| .unwrap_or_else(|err| { | ||
| panic!("Could not create TpuClient with Udp Cache {err:?}"); | ||
| }), | ||
| ), | ||
| } | ||
| } | ||
|
|
||
| fn spy( | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.