From 391a42ec22f121a4f7cf9249d9bf0f01aed69acf Mon Sep 17 00:00:00 2001 From: GroovieGermanikus Date: Tue, 25 Jul 2023 12:00:39 +0200 Subject: [PATCH] wip --- quic-forward-proxy/src/proxy.rs | 6 +++--- .../src/quic_connection_utils.rs | 4 +++- .../tpu_utils/quic_proxy_connection_manager.rs | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/quic-forward-proxy/src/proxy.rs b/quic-forward-proxy/src/proxy.rs index 84ef4dee..41a88d95 100644 --- a/quic-forward-proxy/src/proxy.rs +++ b/quic-forward-proxy/src/proxy.rs @@ -112,11 +112,11 @@ async fn accept_client_connection(client_connection: Connection, tpu_quic_client let maybe_stream = client_connection.accept_uni().await; let mut recv_stream = match maybe_stream { Err(quinn::ConnectionError::ApplicationClosed(reason)) => { - debug!("connection closed by peer - reason: {:?}", reason); + debug!("connection closed by client - reason: {:?}", reason); if reason.error_code != VarInt::from_u32(0) { - return Err(anyhow!("connection closed by peer with unexpected reason: {:?}", reason)); + return Err(anyhow!("connection closed by client with unexpected reason: {:?}", reason)); } - debug!("connection gracefully closed by peer"); + debug!("connection gracefully closed by client"); return Ok(()); }, Err(e) => { diff --git a/quic-forward-proxy/src/quic_connection_utils.rs b/quic-forward-proxy/src/quic_connection_utils.rs index 32883a55..a3019e05 100644 --- a/quic-forward-proxy/src/quic_connection_utils.rs +++ b/quic-forward-proxy/src/quic_connection_utils.rs @@ -214,9 +214,11 @@ impl QuicConnectionUtils { } } Err(elapsed) => { - warn!("timeout sending transactions") + warn!("timeout sending transactions"); } } + + } // TODO wrap in timeout stream.unwrap().finish().await.unwrap(); diff --git a/services/src/tpu_utils/quic_proxy_connection_manager.rs b/services/src/tpu_utils/quic_proxy_connection_manager.rs index 2deceb44..c24e6a3e 100644 --- a/services/src/tpu_utils/quic_proxy_connection_manager.rs +++ b/services/src/tpu_utils/quic_proxy_connection_manager.rs @@ -12,6 +12,7 @@ use futures::FutureExt; use itertools::Itertools; use log::{debug, error, info, warn}; use quinn::{ClientConfig, Connection, Endpoint, EndpointConfig, IdleTimeout, TokioRuntime, TransportConfig}; +use solana_sdk::packet::PACKET_DATA_SIZE; use solana_sdk::pubkey::Pubkey; use solana_sdk::signer::Signer; use solana_sdk::signature::Keypair; @@ -173,14 +174,15 @@ impl QuicProxyConnectionManager { let mut txs = vec![first_tx]; // TODO comment in - // for _ in 1..number_of_transactions_per_unistream { - // if let Ok((signature, tx)) = transaction_receiver.try_recv() { - // // if Self::check_for_confirmation(&txs_sent_store, signature) { - // // continue; - // // } - // txs.push(tx); - // } - // } + let foo = PACKET_DATA_SIZE; + for _ in 1..number_of_transactions_per_unistream { + if let Ok((signature, tx)) = transaction_receiver.try_recv() { + // if Self::check_for_confirmation(&txs_sent_store, signature) { + // continue; + // } + txs.push(tx); + } + } let tpu_fanout_nodes = current_tpu_nodes.read().await.clone();