removes redundant recycler clones (#32401)
This commit is contained in:
parent
4674b0099f
commit
0da01270ef
|
@ -1298,7 +1298,7 @@ impl ServeRepair {
|
|||
nonce: Nonce,
|
||||
) -> Option<PacketBatch> {
|
||||
let mut res =
|
||||
PacketBatch::new_unpinned_with_recycler(recycler.clone(), max_responses, "run_orphan");
|
||||
PacketBatch::new_unpinned_with_recycler(recycler, max_responses, "run_orphan");
|
||||
// Try to find the next "n" parent slots of the input slot
|
||||
let packets = std::iter::successors(blockstore.meta(slot).ok()?, |meta| {
|
||||
blockstore.meta(meta.parent_slot?).ok()?
|
||||
|
|
|
@ -539,7 +539,7 @@ fn start_verify_transactions_gpu(
|
|||
.map(|slice| {
|
||||
let vec_size = slice.len();
|
||||
let mut packet_batch = PacketBatch::new_with_recycler(
|
||||
verify_recyclers.packet_recycler.clone(),
|
||||
&verify_recyclers.packet_recycler,
|
||||
vec_size,
|
||||
"entry-sig-verify",
|
||||
);
|
||||
|
|
|
@ -502,7 +502,7 @@ impl ClusterInfo {
|
|||
.packets_sent_gossip_requests_count
|
||||
.add_relaxed(pings.len() as u64);
|
||||
let packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
|
||||
recycler.clone(),
|
||||
recycler,
|
||||
"refresh_push_active_set",
|
||||
&pings,
|
||||
);
|
||||
|
@ -1653,7 +1653,7 @@ impl ClusterInfo {
|
|||
);
|
||||
if !reqs.is_empty() {
|
||||
let packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
|
||||
recycler.clone(),
|
||||
recycler,
|
||||
"run_gossip",
|
||||
&reqs,
|
||||
);
|
||||
|
@ -2034,7 +2034,7 @@ impl ClusterInfo {
|
|||
let output_size_limit =
|
||||
self.update_data_budget(stakes.len()) / PULL_RESPONSE_MIN_SERIALIZED_SIZE;
|
||||
let mut packet_batch =
|
||||
PacketBatch::new_unpinned_with_recycler(recycler.clone(), 64, "handle_pull_requests");
|
||||
PacketBatch::new_unpinned_with_recycler(recycler, 64, "handle_pull_requests");
|
||||
let (caller_and_filters, addrs): (Vec<_>, Vec<_>) = {
|
||||
let mut rng = rand::thread_rng();
|
||||
let check_pull_request =
|
||||
|
@ -2276,7 +2276,7 @@ impl ClusterInfo {
|
|||
None
|
||||
} else {
|
||||
let packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
|
||||
recycler.clone(),
|
||||
recycler,
|
||||
"handle_ping_messages",
|
||||
&pongs_and_dests,
|
||||
);
|
||||
|
@ -2372,7 +2372,7 @@ impl ClusterInfo {
|
|||
return;
|
||||
}
|
||||
let mut packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
|
||||
recycler.clone(),
|
||||
recycler,
|
||||
"handle_batch_push_messages",
|
||||
&prune_messages,
|
||||
);
|
||||
|
@ -3087,7 +3087,7 @@ pub fn push_messages_to_peer(
|
|||
.map(move |payload| (peer_gossip, Protocol::PushMessage(self_id, payload)))
|
||||
.collect();
|
||||
let packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
|
||||
PacketBatchRecycler::default(),
|
||||
&PacketBatchRecycler::default(),
|
||||
"push_messages_to_peer",
|
||||
&reqs,
|
||||
);
|
||||
|
|
|
@ -43,7 +43,7 @@ impl PacketBatch {
|
|||
}
|
||||
|
||||
pub fn new_unpinned_with_recycler(
|
||||
recycler: PacketBatchRecycler,
|
||||
recycler: &PacketBatchRecycler,
|
||||
capacity: usize,
|
||||
name: &'static str,
|
||||
) -> Self {
|
||||
|
@ -53,7 +53,7 @@ impl PacketBatch {
|
|||
}
|
||||
|
||||
pub fn new_with_recycler(
|
||||
recycler: PacketBatchRecycler,
|
||||
recycler: &PacketBatchRecycler,
|
||||
capacity: usize,
|
||||
name: &'static str,
|
||||
) -> Self {
|
||||
|
@ -67,13 +67,13 @@ impl PacketBatch {
|
|||
name: &'static str,
|
||||
mut packets: Vec<Packet>,
|
||||
) -> Self {
|
||||
let mut batch = Self::new_with_recycler(recycler.clone(), packets.len(), name);
|
||||
let mut batch = Self::new_with_recycler(recycler, packets.len(), name);
|
||||
batch.packets.append(&mut packets);
|
||||
batch
|
||||
}
|
||||
|
||||
pub fn new_unpinned_with_recycler_data_and_dests<T: Serialize>(
|
||||
recycler: PacketBatchRecycler,
|
||||
recycler: &PacketBatchRecycler,
|
||||
name: &'static str,
|
||||
dests_and_data: &[(SocketAddr, T)],
|
||||
) -> Self {
|
||||
|
@ -102,7 +102,7 @@ impl PacketBatch {
|
|||
name: &'static str,
|
||||
mut packets: Vec<Packet>,
|
||||
) -> Self {
|
||||
let mut batch = Self::new_unpinned_with_recycler(recycler.clone(), packets.len(), name);
|
||||
let mut batch = Self::new_unpinned_with_recycler(recycler, packets.len(), name);
|
||||
batch.packets.append(&mut packets);
|
||||
batch
|
||||
}
|
||||
|
@ -278,8 +278,7 @@ mod tests {
|
|||
fn test_to_packets_pinning() {
|
||||
let recycler = PacketBatchRecycler::default();
|
||||
for i in 0..2 {
|
||||
let _first_packets =
|
||||
PacketBatch::new_with_recycler(recycler.clone(), i + 1, "first one");
|
||||
let _first_packets = PacketBatch::new_with_recycler(&recycler, i + 1, "first one");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ fn recv_loop(
|
|||
) -> Result<()> {
|
||||
loop {
|
||||
let mut packet_batch = if use_pinned_memory {
|
||||
PacketBatch::new_with_recycler(recycler.clone(), PACKETS_PER_BATCH, stats.name)
|
||||
PacketBatch::new_with_recycler(recycler, PACKETS_PER_BATCH, stats.name)
|
||||
} else {
|
||||
PacketBatch::with_capacity(PACKETS_PER_BATCH)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue