convert std::sync::mpsc to crossbeam_channel (#22264)

This commit is contained in:
Jeff Biseda
2022-01-11 02:44:46 -08:00
committed by GitHub
parent 3c44d405c7
commit 8b66625c95
81 changed files with 313 additions and 346 deletions

View File

@@ -1,5 +1,6 @@
#![allow(clippy::integer_arithmetic)]
use {
crossbeam_channel::{unbounded, Receiver, Sender, TryRecvError},
rayon::{iter::ParallelIterator, prelude::*},
serial_test::serial,
solana_gossip::{
@@ -11,10 +12,7 @@ use {
solana_streamer::socket::SocketAddrSpace,
std::{
collections::{HashMap, HashSet},
sync::{
mpsc::{channel, Receiver, Sender, TryRecvError},
Arc, Mutex,
},
sync::{Arc, Mutex},
time::Instant,
},
};
@@ -90,7 +88,7 @@ fn run_simulation(stakes: &[u64], fanout: usize) {
let mut staked_nodes = HashMap::new();
// setup accounts for all nodes (leader has 0 bal)
let (s, r) = channel();
let (s, r) = unbounded();
let senders: Arc<Mutex<HashMap<Pubkey, Sender<(i32, bool)>>>> =
Arc::new(Mutex::new(HashMap::new()));
senders.lock().unwrap().insert(leader_info.id, s);
@@ -109,7 +107,7 @@ fn run_simulation(stakes: &[u64], fanout: usize) {
let node = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0);
staked_nodes.insert(node.id, stakes[*i - 1]);
cluster_info.insert_info(node.clone());
let (s, r) = channel();
let (s, r) = unbounded();
batches
.get_mut(batch_ix)
.unwrap()