pub fn new(
        network_events: ConsensusNetworkEvents,
        self_receiver: channel::Receiver<failure::Result<Event<ConsensusMsg>>>,
        validators: Arc<ValidatorVerifier>,
    ) -> (NetworkTask<T>, NetworkReceivers<T>) {
        let (proposal_tx, proposal_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::PROPOSAL_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::PROPOSAL_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::PROPOSAL_DEQUEUED_MSGS,
            }),
        ));
        let (vote_tx, vote_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::VOTES_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::VOTES_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::VOTES_DEQUEUED_MSGS,
            }),
        ));
        let (block_request_tx, block_request_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::BLOCK_RETRIEVAL_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::BLOCK_RETRIEVAL_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::BLOCK_RETRIEVAL_DEQUEUED_MSGS,
            }),
        ));
        let (sync_info_tx, sync_info_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::SYNC_INFO_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::SYNC_INFO_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::SYNC_INFO_DEQUEUED_MSGS,
            }),
        ));
        let network_events = network_events.map_err(Into::<failure::Error>::into);
        let all_events = Box::new(select(network_events, self_receiver));
        (
            NetworkTask {
                proposal_tx,
                vote_tx,
                block_request_tx,
                sync_info_tx,
                all_events,
                validators,
            },
            NetworkReceivers {
                proposals: proposal_rx,
                votes: vote_rx,
                block_retrieval: block_request_rx,
                sync_info_msgs: sync_info_rx,
            },
        )
    }
/// Establishes the initial connections with the peers and returns the receivers.
Establishes the initial connections with the peers and returns the receivers.
Establishes the initial connections with the peers and returns the receivers .
pub fn new(
        network_events: ConsensusNetworkEvents,
        self_receiver: channel::Receiver<failure::Result<Event<ConsensusMsg>>>,
        validators: Arc<ValidatorVerifier>,
    ) -> (NetworkTask<T>, NetworkReceivers<T>) {
        let (proposal_tx, proposal_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::PROPOSAL_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::PROPOSAL_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::PROPOSAL_DEQUEUED_MSGS,
            }),
        ));
        let (vote_tx, vote_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::VOTES_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::VOTES_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::VOTES_DEQUEUED_MSGS,
            }),
        ));
        let (block_request_tx, block_request_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::BLOCK_RETRIEVAL_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::BLOCK_RETRIEVAL_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::BLOCK_RETRIEVAL_DEQUEUED_MSGS,
            }),
        ));
        let (sync_info_tx, sync_info_rx) = libra_channel::new(PerValidatorQueue::new(
            QueueStyle::LIFO,
            1,
            Some(message_queues::Counters {
                dropped_msgs_counter: &counters::SYNC_INFO_DROPPED_MSGS,
                enqueued_msgs_counter: &counters::SYNC_INFO_ENQUEUED_MSGS,
                dequeued_msgs_counter: &counters::SYNC_INFO_DEQUEUED_MSGS,
            }),
        ));
        let network_events = network_events.map_err(Into::<failure::Error>::into);
        let all_events = Box::new(select(network_events, self_receiver));
        (
            NetworkTask {
                proposal_tx,
                vote_tx,
                block_request_tx,
                sync_info_tx,
                all_events,
                validators,
            },
            NetworkReceivers {
                proposals: proposal_rx,
                votes: vote_rx,
                block_retrieval: block_request_rx,
                sync_info_msgs: sync_info_rx,
            },
        )
    }
pub fn new ( network_events : ConsensusNetworkEvents , self_receiver : channel :: Receiver < failure :: Result < Event < ConsensusMsg > > > , validators : Arc < ValidatorVerifier > , ) -> ( NetworkTask < T > , NetworkReceivers < T > ) { let ( proposal_tx , proposal_rx ) = libra_channel :: new ( PerValidatorQueue :: new ( QueueStyle :: LIFO , 1 , Some ( message_queues :: Counters { dropped_msgs_counter : & counters :: PROPOSAL_DROPPED_MSGS , enqueued_msgs_counter : & counters :: PROPOSAL_ENQUEUED_MSGS , dequeued_msgs_counter : & counters :: PROPOSAL_DEQUEUED_MSGS , } ) , ) ) ; let ( vote_tx , vote_rx ) = libra_channel :: new ( PerValidatorQueue :: new ( QueueStyle :: LIFO , 1 , Some ( message_queues :: Counters { dropped_msgs_counter : & counters :: VOTES_DROPPED_MSGS , enqueued_msgs_counter : & counters :: VOTES_ENQUEUED_MSGS , dequeued_msgs_counter : & counters :: VOTES_DEQUEUED_MSGS , } ) , ) ) ; let ( block_request_tx , block_request_rx ) = libra_channel :: new ( PerValidatorQueue :: new ( QueueStyle :: LIFO , 1 , Some ( message_queues :: Counters { dropped_msgs_counter : & counters :: BLOCK_RETRIEVAL_DROPPED_MSGS , enqueued_msgs_counter : & counters :: BLOCK_RETRIEVAL_ENQUEUED_MSGS , dequeued_msgs_counter : & counters :: BLOCK_RETRIEVAL_DEQUEUED_MSGS , } ) , ) ) ; let ( sync_info_tx , sync_info_rx ) = libra_channel :: new ( PerValidatorQueue :: new ( QueueStyle :: LIFO , 1 , Some ( message_queues :: Counters { dropped_msgs_counter : & counters :: SYNC_INFO_DROPPED_MSGS , enqueued_msgs_counter : & counters :: SYNC_INFO_ENQUEUED_MSGS , dequeued_msgs_counter : & counters :: SYNC_INFO_DEQUEUED_MSGS , } ) , ) ) ; let network_events = network_events . map_err ( Into :: < failure :: Error > :: into ) ; let all_events = Box :: new ( select ( network_events , self_receiver ) ) ; ( NetworkTask { proposal_tx , vote_tx , block_request_tx , sync_info_tx , all_events , validators , } , NetworkReceivers { proposals : proposal_rx , votes : vote_rx , block_retrieval : block_request_rx , sync_info_msgs : sync_info_rx , } , ) }
Establishes the initial connections with the peers and returns the receivers.
Establishes the initial connections with the peers and returns the receivers .
network_events
ConsensusNetworkEvents
self_receiver
channel::Receiver<failure::Result<Event<ConsensusMsg>>>
validators
Arc<ValidatorVerifier>
network_events
ConsensusNetworkEvents
self_receiver
channel::Receiver<failure::Result<Event<ConsensusMsg>>>
validators
Arc<ValidatorVerifier>