Synchronous import queue + fix async inport queue shutdown (#2701)

* sync implementation of ImportQueue

* fix import queue shutdown

* never clone import queue
This commit is contained in:
Svyatoslav Nikolsky authored and Gavin Wood committed 2019-05-28 15:07:35 +02:00
1 parent 549d9e1da1
commit 48b2ba041f
4 files changed
+394 -212

No files matched your search

+11 -11
View File
@@ -211,6 +211,14 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>> Service<B, S> {
let (network_chan, network_port) = mpsc::unbounded();
let (protocol_sender, protocol_rx) = mpsc::unbounded();
let status_sinks = Arc::new(Mutex::new(Vec::new()));
// connect the import-queue to the network service.
let link = NetworkLink {
protocol_sender: protocol_sender.clone(),
network_sender: network_chan.clone(),
};
import_queue.start(Box::new(link))?;
// Start in off-line mode, since we're not connected to any nodes yet.
let is_offline = Arc::new(AtomicBool::new(true));
let is_major_syncing = Arc::new(AtomicBool::new(false));
@@ -229,7 +237,7 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>> Service<B, S> {
is_major_syncing.clone(),
protocol,
peers.clone(),
import_queue.clone(),
import_queue,
params.transaction_pool,
params.finality_proof_provider,
network_port,
@@ -244,22 +252,14 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>> Service<B, S> {
status_sinks,
is_offline,
is_major_syncing,
network_chan: network_chan.clone(),
network_chan,
peers,
peerset,
network,
protocol_sender: protocol_sender.clone(),
protocol_sender,
bg_thread: Some(thread),
});
// connect the import-queue to the network service.
let link = NetworkLink {
protocol_sender,
network_sender: network_chan,
};
import_queue.start(Box::new(link))?;
Ok(service)
}