fixed test build

This commit is contained in:
Andreas Fackler 2018-04-14 10:40:06 +02:00
parent 13081f75ee
commit fc3e502c5a
3 changed files with 7 additions and 11 deletions

View File

@ -87,10 +87,10 @@ impl<T: Clone + Debug + Send + Sync> Messaging<T> {
.map(|_| unbounded())
.collect();
let to_comms_txs = to_comms.iter()
.map(|(tx, _)| tx.to_owned())
.map(|&(ref tx, _)| tx.to_owned())
.collect();
let to_comms_rxs: Vec<Receiver<Message<T>>> = to_comms.iter()
.map(|(_, rx)| rx.to_owned())
.map(|&(_, ref rx)| rx.to_owned())
.collect();
let (from_comms_tx, from_comms_rx) = unbounded();
let to_algo: Vec<(Sender<SourcedMessage<T>>,
@ -99,10 +99,10 @@ impl<T: Clone + Debug + Send + Sync> Messaging<T> {
.map(|_| unbounded())
.collect();
let to_algo_txs = to_algo.iter()
.map(|(tx, _)| tx.to_owned())
.map(|&(ref tx, _)| tx.to_owned())
.collect();
let to_algo_rxs: Vec<Receiver<SourcedMessage<T>>> = to_algo.iter()
.map(|(_, rx)| rx.to_owned())
.map(|&(_, ref rx)| rx.to_owned())
.collect();
let (from_algo_tx, from_algo_rx) = unbounded();

View File

@ -18,16 +18,16 @@ pub struct NetSim<Message: Clone + Send + Sync> {
impl<Message: Clone + Send + Sync> NetSim<Message> {
pub fn new(num_nodes: usize) -> Self {
assert!(num_nodes > 1);
// All channels of a totally conected network of size `num_nodes`.
// All channels of a totally connected network of size `num_nodes`.
let channels: Vec<(Sender<Message>, Receiver<Message>)> =
(0 .. num_nodes * num_nodes)
.map(|_| unbounded())
.collect();
let txs = channels.iter()
.map(|(tx, _)| tx.to_owned())
.map(|&(ref tx, _)| tx.to_owned())
.collect();
let rxs = channels.iter()
.map(|(_, rx)| rx.to_owned())
.map(|&(_, ref rx)| rx.to_owned())
.collect();
NetSim {
num_nodes: num_nodes,

View File

@ -2,10 +2,6 @@
//! simulated remote node through a channel. Local communication with
//! coordinating threads is also made via a channel.
extern crate hbbft;
extern crate crossbeam;
extern crate crossbeam_channel;
use std::io;
use std::fmt::Debug;
use std::sync::Arc;