Skip to content

Commit

Permalink
get rid of Arc
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Sep 26, 2023
1 parent 027f771 commit 23044f0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions quic-forward-proxy/src/outbound/ng_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::outbound::debouncer::Debouncer;
use crate::outbound::sharder::Sharder;

Check warning on line 2 in quic-forward-proxy/src/outbound/ng_forward.rs

View workflow job for this annotation

GitHub Actions / Test lite-rpc against running Validator

unused import: `crate::outbound::sharder::Sharder`
use crate::quic_util::SkipServerVerification;

Check warning on line 3 in quic-forward-proxy/src/outbound/ng_forward.rs

View workflow job for this annotation

GitHub Actions / Test lite-rpc against running Validator

unused import: `crate::quic_util::SkipServerVerification`
use crate::quinn_auto_reconnect::AutoReconnect;

Check warning on line 4 in quic-forward-proxy/src/outbound/ng_forward.rs

View workflow job for this annotation

GitHub Actions / Test lite-rpc against running Validator

unused import: `crate::quinn_auto_reconnect::AutoReconnect`
use crate::shared::{ForwardPacket, TxRawData};
use crate::shared::{ForwardPacket};
use crate::util::timeout_fallback;

Check warning on line 6 in quic-forward-proxy/src/outbound/ng_forward.rs

View workflow job for this annotation

GitHub Actions / Test lite-rpc against running Validator

unused import: `crate::util::timeout_fallback`
use crate::validator_identity::ValidatorIdentity;
use anyhow::{bail, Context};

Check warning on line 8 in quic-forward-proxy/src/outbound/ng_forward.rs

View workflow job for this annotation

GitHub Actions / Test lite-rpc against running Validator

unused import: `Context`
Expand All @@ -19,8 +19,10 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::time::{Duration, Instant};
use itertools::Itertools;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::transaction::VersionedTransaction;
use tokio::pin;
use tokio::sync::mpsc::Receiver;
use tokio::sync::RwLock;
use solana_lite_rpc_core::quic_connection_utils::QuicConnectionParameters;
Expand Down Expand Up @@ -86,18 +88,17 @@ pub async fn ng_forwarder(
bail!("exit signal received");
}

let forward_packet = Arc::new(
let forward_packet =
transaction_channel
.recv()
.await
.expect("channel closed unexpectedly"),
);
.expect("channel closed unexpectedly");
let tpu_address = forward_packet.tpu_address;
let tpu_identity = forward_packet.tpu_identity;

// TODO optimize move into tpu_connection_manager and implement shutdown based on not used
connections_to_keep.insert(tpu_identity, tpu_address);

// TODO optimize
tpu_connection_manager
.update_connections(
broadcast_sender.clone(),
Expand All @@ -110,12 +111,11 @@ pub async fn ng_forwarder(

tpu_connection_manager.cleanup_unused_connections(&connections_to_keep).await;

for raw_tx in &forward_packet.transactions {
let tsi = ProxiedTransaction {
// signature: raw_tx.signature.clone(),
transaction: raw_tx.clone(),
for raw_tx in forward_packet.transactions {
let transaction = ProxiedTransaction {
transaction: raw_tx,
};
broadcast_sender.send(tsi)?;
broadcast_sender.send(transaction).expect("failed to send to broadcast");
}

} // all txs in packet
Expand Down

0 comments on commit 23044f0

Please sign in to comment.