Skip to content

Commit

Permalink
extract identity stakes logic
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Sep 28, 2023
1 parent c07b1f5 commit 7ea0bca
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ pub fn with_1000_transactions_direct() {
}

// note: this tests are flakes on CI ond also local (see https://mangolana.atlassian.net/browse/MAN-59)
#[ignore]
#[test]
pub fn bench_proxy() {
configure_logging(true);
Expand Down
1 change: 0 additions & 1 deletion quic-forward-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod outbound;
pub mod proxy;
pub mod proxy_request_format;
mod quic_util;
mod quinn_auto_reconnect;
pub mod tls_config_provider_client;
pub mod tls_config_provider_server;
pub mod tls_self_signed_pair_generator;
Expand Down
1 change: 0 additions & 1 deletion quic-forward-proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ mod outbound;
pub mod proxy;
pub mod proxy_request_format;
pub mod quic_util;
mod quinn_auto_reconnect;
pub mod tls_config_provider_client;
pub mod tls_config_provider_server;
pub mod tls_self_signed_pair_generator;
Expand Down
10 changes: 8 additions & 2 deletions quic-forward-proxy/src/outbound/ng_forward.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::validator_identity::ValidatorIdentity;
use anyhow::{bail};
use solana_streamer::nonblocking::quic::{ConnectionPeerType};
use solana_streamer::nonblocking::quic::{compute_max_allowed_uni_streams, ConnectionPeerType};
use solana_streamer::tls_certificates::new_self_signed_tls_certificate;
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
Expand Down Expand Up @@ -78,10 +78,16 @@ pub async fn ng_forwarder(
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,
identity_stakes,
max_uni_stream_connections,
DataCache::new_for_tests(),
QUIC_CONNECTION_PARAMS, // TODO improve
)
Expand Down
11 changes: 3 additions & 8 deletions quic-forward-proxy/src/outbound/tpu_connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,12 @@ impl ActiveConnection {
pub fn start_listening(
&self,
broadcast_receiver: Receiver<BroadcastMessage>,
identity_stakes: IdentityStakesData,
max_uni_stream_connections: usize,
) {
let addr = self.tpu_address;

let max_number_of_connections = self.connection_parameters.max_number_of_connections;

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

let connection_pool = QuicConnectionPool::new(
Expand Down Expand Up @@ -232,7 +227,7 @@ impl TpuConnectionManager {
pub async fn update_connections(
&self,
requested_connections: &HashMap<Pubkey, SocketAddr>,
identity_stakes: IdentityStakesData,
max_uni_stream_connections: usize,
data_cache: DataCache,
connection_parameters: QuicConnectionParameters,
) {
Expand All @@ -252,7 +247,7 @@ impl TpuConnectionManager {

let broadcast_receiver = self.broadcast_sender.subscribe();

active_connection.start_listening(broadcast_receiver, identity_stakes);
active_connection.start_listening(broadcast_receiver, max_uni_stream_connections);
self.identity_to_active_connection.insert(
*tpu_identity,
Arc::new(active_connection),
Expand Down
249 changes: 0 additions & 249 deletions quic-forward-proxy/src/quinn_auto_reconnect.rs

This file was deleted.

0 comments on commit 7ea0bca

Please sign in to comment.