Tidy networking crates

This commit is contained in:
Age Manning
2019-03-19 22:53:51 +11:00
parent dc014d07bc
commit e7f87112fb
9 changed files with 26 additions and 45 deletions

View File

@@ -3,7 +3,7 @@ use beacon_chain::{
db::{ClientDB, DiskDB, MemoryDB},
fork_choice::BitwiseLMDGhost,
initialise,
slot_clock::{SlotClock, SystemTimeSlotClock, TestingSlotClock},
slot_clock::{SlotClock, SystemTimeSlotClock},
BeaconChain,
};
use fork_choice::ForkChoice;

View File

@@ -11,7 +11,7 @@ pub use client_types::ClientTypes;
//use beacon_chain::BeaconChain;
use beacon_chain::BeaconChain;
use exit_future::{Exit, Signal};
use exit_future::Signal;
use network::Service as NetworkService;
use slog::o;
use std::marker::PhantomData;
@@ -55,7 +55,7 @@ impl<TClientType: ClientTypes> Client<TClientType> {
// TODO: Add beacon_chain reference to network parameters
let network_config = &config.net_conf;
let network_logger = log.new(o!("Service" => "Network"));
let (network, network_send) = NetworkService::new(
let (network, _network_send) = NetworkService::new(
beacon_chain.clone(),
network_config,
executor,

View File

@@ -1,12 +1,8 @@
use crate::Client;
use crate::ClientTypes;
use db::ClientDB;
use exit_future::Exit;
use fork_choice::ForkChoice;
use futures::{Future, Stream};
use network::NodeMessage;
use slog::{debug, info, o};
use slot_clock::SlotClock;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
use tokio::runtime::TaskExecutor;
@@ -27,12 +23,13 @@ pub fn run<T: ClientTypes>(client: &Client<T>, executor: TaskExecutor, exit: Exi
// build heartbeat logic here
let heartbeat = move |_| {
info!(log, "Temp heartbeat output");
//TODO: Remove this logic. Testing only
let mut count = counter.lock().unwrap();
*count += 1;
if *count % 5 == 0 {
debug!(log, "Sending Message");
network.send_message(String::from("Testing network channel"))
network.send_message();
}
Ok(())