mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 06:31:09 +00:00
Rewrite sync and network layers to use futures (#2683)
* Remove background thread from network * Primarily use tokio-timer instead of tokio * Minor style fix * Reintroduce tokio as an optional dependency * Renames * Line width * Ctxt -> Context * Merge NetworkWorker and NetworkService
This commit is contained in:
committed by
Arkadiy Paronyan
parent
643e309411
commit
e9a4c80c40
@@ -38,7 +38,8 @@ use parking_lot::Mutex;
|
||||
// Type aliases.
|
||||
// These exist mainly to avoid typing `<F as Factory>::Foo` all over the code.
|
||||
/// Network service type for a factory.
|
||||
pub type NetworkService<F> = network::Service<<F as ServiceFactory>::Block, <F as ServiceFactory>::NetworkProtocol>;
|
||||
pub type NetworkService<F> =
|
||||
network::NetworkService<<F as ServiceFactory>::Block, <F as ServiceFactory>::NetworkProtocol>;
|
||||
|
||||
/// Code executor type for a factory.
|
||||
pub type CodeExecutor<F> = NativeExecutor<<F as ServiceFactory>::RuntimeDispatch>;
|
||||
|
||||
@@ -203,7 +203,13 @@ impl<Components: components::Components> Service<Components> {
|
||||
};
|
||||
|
||||
let has_bootnodes = !network_params.network_config.boot_nodes.is_empty();
|
||||
let network = network::Service::new(network_params)?;
|
||||
let network_mut = network::NetworkWorker::new(network_params)?;
|
||||
let network = network_mut.service().clone();
|
||||
|
||||
task_executor.spawn(network_mut
|
||||
.map_err(|_| ())
|
||||
.select(exit.clone())
|
||||
.then(|_| Ok(())));
|
||||
|
||||
let inherents_pool = Arc::new(InherentsPool::default());
|
||||
let offchain_workers = if config.offchain_worker {
|
||||
|
||||
Reference in New Issue
Block a user