Rewrite network protocol/service to use channels (#1340)

* rewrite network protocol/service to use channels

* remove use of unwrap

* re-introduce with_spec

* remove unnecessary mut

* remove unused param

* improve with_spec, add with_gossip

* rename job to task

* style: re-add comma

* remove extra string allocs

* rename use of channel

* turn TODO into FIXME

* remove mut in match

* remove Self in new

* pass headers by value to network service

* remove network sender from service

* remove TODO

* better expect

* rationalize use of network sender in ondemand
This commit is contained in:
Gregory Terzian
2019-02-06 19:54:02 +08:00
committed by Bastian Köcher
parent 8aae19e2db
commit a2d2ed69ab
19 changed files with 1314 additions and 903 deletions
+3 -2
View File
@@ -20,6 +20,8 @@
//! Substrate-specific P2P networking: synchronizing blocks, propagating BFT messages.
//! Allows attachment of an optional subprotocol for chain-specific requests.
#[macro_use]
extern crate crossbeam_channel;
extern crate linked_hash_map;
extern crate lru_cache;
extern crate parking_lot;
@@ -51,7 +53,6 @@ mod service;
mod sync;
#[macro_use]
mod protocol;
mod io;
mod chain;
mod blocks;
mod on_demand;
@@ -65,7 +66,7 @@ pub mod specialization;
pub mod test;
pub use chain::Client as ClientHandle;
pub use service::{Service, FetchFuture, TransactionPool, ManageNetwork, SyncProvider, ExHashT};
pub use service::{Service, FetchFuture, TransactionPool, ManageNetwork, NetworkMsg, SyncProvider, ExHashT};
pub use protocol::{ProtocolStatus, PeerInfo, Context};
pub use sync::{Status as SyncStatus, SyncState};
pub use network_libp2p::{