Skip to content

Commit

Permalink
remove DataCache
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Sep 28, 2023
1 parent 7ea0bca commit 39ec405
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 49 deletions.
1 change: 0 additions & 1 deletion quic-forward-proxy/src/outbound/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mod debouncer;
mod sharder;
pub mod ng_forward;
mod tpu_connection_manager;
16 changes: 5 additions & 11 deletions quic-forward-proxy/src/outbound/ng_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use log::info;
use solana_sdk::pubkey::Pubkey;
use tokio::sync::mpsc::Receiver;
use solana_lite_rpc_core::quic_connection_utils::QuicConnectionParameters;
use solana_lite_rpc_core::stores::data_cache::DataCache;
use solana_lite_rpc_core::structures::identity_stakes::IdentityStakesData;
use crate::outbound::tpu_connection_manager::{TpuConnectionManager};
use crate::proxy_request_format::TpuForwardingRequest;
Expand Down Expand Up @@ -58,10 +57,13 @@ pub async fn ng_forwarder(
total_stakes: 100,
};


let max_uni_stream_connections = compute_max_allowed_uni_streams(
identity_stakes.peer_type,
identity_stakes.stakes,
identity_stakes.total_stakes,
);

loop {
info!("tick2");
if exit_signal.load(Ordering::Relaxed) {
bail!("exit signal received");
}
Expand All @@ -74,21 +76,13 @@ pub async fn ng_forwarder(

let mut requested_connections: HashMap<Pubkey, SocketAddr> = HashMap::new();
for tpu_node in forward_packet.get_tpu_nodes() {
// TODO optimize move into tpu_connection_manager and implement shutdown based on not used
requested_connections.insert(tpu_node.identity_tpunode, tpu_node.tpu_socket_addr);
}

let max_uni_stream_connections = compute_max_allowed_uni_streams(
identity_stakes.peer_type,
identity_stakes.stakes,
identity_stakes.total_stakes,
);

tpu_connection_manager
.update_connections(
&requested_connections,
max_uni_stream_connections,
DataCache::new_for_tests(),
QUIC_CONNECTION_PARAMS, // TODO improve
)
.await;
Expand Down
32 changes: 0 additions & 32 deletions quic-forward-proxy/src/outbound/sharder.rs

This file was deleted.

5 changes: 0 additions & 5 deletions quic-forward-proxy/src/outbound/tpu_connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ struct ActiveConnection {
identity: Pubkey,
tpu_address: SocketAddr,
exit_signal: Arc<AtomicBool>,
data_cache: DataCache,
connection_parameters: QuicConnectionParameters,
last_used: Arc<AtomicTiming>,
}
Expand All @@ -68,15 +67,13 @@ impl ActiveConnection {
endpoints: RotatingQueue<Endpoint>,
tpu_address: SocketAddr,
identity: Pubkey,
data_cache: DataCache,
connection_parameters: QuicConnectionParameters,
) -> Self {
Self {
endpoints,
tpu_address,
identity,
exit_signal: Arc::new(AtomicBool::new(false)),
data_cache,
connection_parameters,
last_used: Arc::new(AtomicTiming::default()),
}
Expand Down Expand Up @@ -228,7 +225,6 @@ impl TpuConnectionManager {
&self,
requested_connections: &HashMap<Pubkey, SocketAddr>,
max_uni_stream_connections: usize,
data_cache: DataCache,
connection_parameters: QuicConnectionParameters,
) {
NB_CONNECTIONS_TO_KEEP.set(requested_connections.len() as i64);
Expand All @@ -241,7 +237,6 @@ impl TpuConnectionManager {
self.endpoints.clone(),
*tpu_addr,
*tpu_identity,
data_cache.clone(),
connection_parameters,
);

Expand Down

0 comments on commit 39ec405

Please sign in to comment.