Forward transactions as packets instead of blobs (#5334)
* Forward transactions as packets instead of blobs * clippy
This commit is contained in:
@@ -134,46 +134,6 @@ pub fn blob_receiver(
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn recv_blob_packets(sock: &UdpSocket, s: &PacketSender, recycler: &PacketsRecycler) -> Result<()> {
|
||||
trace!(
|
||||
"recv_blob_packets: receiving on {}",
|
||||
sock.local_addr().unwrap()
|
||||
);
|
||||
|
||||
let blobs = Blob::recv_from(sock)?;
|
||||
for blob in blobs {
|
||||
let mut packets =
|
||||
Packets::new_with_recycler(recycler.clone(), PACKETS_PER_BLOB, "recv_blob_packets");
|
||||
blob.read().unwrap().load_packets(&mut packets.packets);
|
||||
s.send(packets)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn blob_packet_receiver(
|
||||
sock: Arc<UdpSocket>,
|
||||
exit: &Arc<AtomicBool>,
|
||||
s: PacketSender,
|
||||
) -> JoinHandle<()> {
|
||||
//DOCUMENTED SIDE-EFFECT
|
||||
//1 second timeout on socket read
|
||||
let timer = Duration::new(1, 0);
|
||||
sock.set_read_timeout(Some(timer))
|
||||
.expect("set socket timeout");
|
||||
let exit = exit.clone();
|
||||
let recycler = PacketsRecycler::default();
|
||||
Builder::new()
|
||||
.name("solana-blob_packet_receiver".to_string())
|
||||
.spawn(move || loop {
|
||||
if exit.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
let _ = recv_blob_packets(&sock, &s, &recycler);
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
Reference in New Issue
Block a user